[에러] Expectation Violation: Duplicate atom key "writeFormState". This is a FATAL ERROR in production. But it is safe to ignore this warning if it occurred because of hot module replacement.

적자생존·2023년 2월 1일
0

error

목록 보기
10/12
  1. 에러 발생

Expectation Violation: Duplicate atom key "writeFormState". This is a FATAL ERROR in production. But it is safe to ignore this warning if it occurred because of hot module replacement.

  1. 원인

recoil store의 key가 복제 되었습니다. 치명적인 문제는 아닙니다.

  1. 해결

가. 무시

조금 찜찜하다,,,,

나. atom의 key값을 난수로 지정

npm i uuid
npm i --save-dev @types/uuid

uuid를 설치하고

import { atom } from "recoil";
import { v4 as uuidv4 } from "uuid";
export const state = atom({
  key: `${uuidv4()}`,
  default: {
    
  },
});

uuid를 이용해 난수로 지정하면 된다.

profile
적는 자만이 생존한다.

0개의 댓글