nextjs에서 useEffect가 아무리봐도 2번 실행시킬 코드가 아닌데 자꾸 2번 실행돼서 찾아봤다.

자꾸 2번 실행된다

 

next.config.js 에서  reactStrictMode 를 false 로 변경하고 앱을 재실행하자.

[ Found a change in next.config.js. Restart the server to see the changes in effect. ]

const nextConfig = {
  reactStrictMode: false,
}

 

됐다

 

https://stackoverflow.com/questions/71835580/useeffect-being-called-twice-in-nextjs-typescript-app

 

useEffect being called twice in Nextjs Typescript app

I have a simple useEffect function setup with the brackets like so: useEffect(() => { console.log('hello') getTransactions() }, []) However when I run my app, it prints two hellos i...

stackoverflow.com

 

+ Recent posts