
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.
const [inputValue, setInputValue] = useState<string>();
<input
type="text"
onChange={onChangeHandler}
value={inputValue}
/>
인풋창을 입력하는 순간 이런 에러가 뜨더라..
input value 로 undefined 가 들어가서 그런듯하다?
아래와 같이 수정하니 에러가 사라졌다.
const [inputValue, setInputValue] = useState<string>();
<input
type="text"
onChange={onChangeHandler}
value={inputValue || ''}
/>