Duplicate atom key ERROR

JJVoiture·2022년 8월 24일
0
Expectation Violation: Duplicate atom key "~~".

This is a FATAL ERROR in production.
But it is safe to ignore this warning if it occurred because of hot module replacement.

원인

https://github.com/facebookexperimental/Recoil/issues/733

In development, when a file is changed, Next.js re-builds the relevant page entry file.Because it's the same Node.js process, the atom has already been declared.The same thing can happen with HMR when the file change triggers a rebuild of the whole file, or even when the atom is declared inside a component lifecycle/hook and only that is being hot-replaced.

Next.js 개발 중 파일이 변경될 때 다시 빌드되는 과정에서 atom이 재선언된다.
재선언될 때 이미 key로 선언된 값을 key로 써서 발생하는 문제이다.
Next.js 개발 시 recoil을 사용하면 발생하는 문제이다.

Recoil이란?

profile
안녕하세요.

0개의 댓글