728x90
- react_devtools_backend.js:4026 Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component
영어실력이 부족해서 구글번역을 돌려보면 react_devtools_backend.js:4026 경고: 구성 요소가 제어되지 않는 입력을 제어하도록 변경하고 있습니다. 이는 값이 정의되지 않은 값에서 정의된 값으로 변경되기 때문에 발생할 수 있으며, 이는 발생해서는 안 됩니다. 구성 요소의 수명 동안 제어 또는 제어되지 않은 입력 요소를 사용할지 결정 이렇게 나옵니다! - 에러가 발생한 경우는 값의 변경이 제대로 되지 않았을 때 나오는 경우입니다.
해당 에러가 발생한 경우는 DTO나 state가 null 일 때 나타납니다. 오류의 해결 방법은 간단합니다.
// 변경 전
<input value={dto.name}/>
// 변경 후
<input value={dto.name || ''}>
'Programming > React' 카테고리의 다른 글
[React] 자주쓰는 yarn commend 목록 (0) | 2022.08.10 |
---|---|
[React]filter, map, react-router-dom v6 활용기 (0) | 2022.08.05 |
[React] Images 활용하기 (0) | 2022.08.02 |
[React]React말고 next.js사용 (0) | 2022.07.30 |
[React]라이프사이클 알아보기 (0) | 2022.07.29 |