기능 공유 및 에러핸들링
The above error occurred in the <input> component
Fo_rdang
2024. 8. 21. 19:20
반응형
에러 메시지
The above error occurred in the <input> component:
React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
에러 발생 코드
에러 이유
- input 태그는 닫는 태그 없이 사용해댜 한다.
- 즉, input 태그는 self-closing 태그이다.
코드 수정
- input의 value 속성으로 값을 넣는다.
=> input 필드가 data.nickname 값으로 초기화되고,
=> 값이 update 될 때마다 input 필드의 값도 자동으로 업데이트 된다.
반응형