defaultValue vs. value / Controlled vs. Uncontrolled
If you're using state to manage the value of an input, you'd use the value attribute to make it a controlled component. This means React would manage the input's state.
However, since you're not using state, you can use defaultValue. This means the native input will manage its own state. This is okay since you're saving the search query to the URL instead of state.
value 속성 : state 이용해서 관리 할때, useState() 등등
defaultValue 속성 : 별도의 state tool 쓰지 않을때. URL에 자체 저장
{} jsx에서 에스케이프 하기 (1) | 2024.06.20 |
---|---|
shadcn/ui 설치 전후 폴더 구조 (0) | 2024.06.19 |
useSearchParams, usePathname, useRouter - next.js (0) | 2024.05.13 |
fonts 관리 (0) | 2024.05.13 |
export default (0) | 2024.04.28 |