๐ค ์์งlog ๐ค
[ERROR] Warning: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`. ๋ณธ๋ฌธ
๐ฅ TIP
[ERROR] Warning: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
Eun_zii 2023. 10. 30. 15:54
form ํ๋์ value๋ฅผ ์ฌ์ฉํ๋ฉด์ onChange ํธ๋ค๋ฌ๋ฅผ ์ค์ ํ์ง ์์ ๋ฐ์ํ๋ ์๋ฌ
โ ํด๊ฒฐ๋ฐฉ๋ฒ
1. onChange ํธ๋ค๋ฌ ์ค์
const onChange = () => {
// onChange ์ด๋ฒคํธ
}
<input
value={value}
onChange={onChange}
/>
2. defaultValue ์ต์ ์ค์
: value ์ต์ ์ defaultValue๋ก ๋ณ๊ฒฝ
<input
defaultValue={value}
/>
3. readonly ์ต์ ์ถ๊ฐ
<input
value={value}
readonly
/>
728x90
'๐ฅ TIP' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[FRONTEND] ํ๋ก ํธ์๋ ๊ธฐ์ ๋ฉด์ ๊ฐ๋ ์ ๋ฆฌ (0) | 2023.11.16 |
---|---|
[NodeJS] CORS Error ํด๊ฒฐํ๊ธฐ (0) | 2023.09.22 |
[NextJS] Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? (0) | 2023.03.26 |
[Git] ๊น๋ฉ(GitLab) ์ฌ์ฉํ๊ธฐ (0) | 2023.03.24 |
[SelectBox] ์ต์ ์/์ค๋๋์ ์ ๋ ฌํ๊ธฐ (0) | 2023.01.03 |