Skip to content

Instantly share code, notes, and snippets.

@Curookie
Last active February 19, 2023 12:39
Show Gist options
  • Save Curookie/5fc0b0b402c618bbbb40c0deaf17f300 to your computer and use it in GitHub Desktop.
Save Curookie/5fc0b0b402c618bbbb40c0deaf17f300 to your computer and use it in GitHub Desktop.
javascript

기록

React Hook에서 setState(변경값)으로 즉시 변경하기 위해선 const -> let으로 변경하고 아래와 같이 변수에 집어넣는 코드를 한줄 더 입력하면 된다.

    network = klaytn.networkVersion;
    setNetwork(klaytn.networkVersion);

React Hook에서 Nubmer 타입으로 정의한 useState는 더하기 연산 시에 반드시 Number(변수) 로 형변환을 해야한다.

setInterval(함수, 시간) 에서 시간 부분에 변수를 넣어도 처음 생성될 때 고정된 값이 변하지 않는다.
time = 1000;
setInterval(블라블라 안에서 time을 2000으로 바꿈, time); 이럴경우 time은 계속 1000이라는 말

그냥 SetTimeOut으로 재귀함수 만들어서 사용하는게 좋음.

@Faruk45
Copy link

Faruk45 commented May 4, 2022

Verify Github on Galaxy. gid:pxb6w3orL76UBLpYwVJb9W

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment