estoy en mi proyecto de aluraGeek y estoy usando react hook form.
import { useForm, Controller } from "react-hook-form"
const [categoryList, setCategoryList] = useState([])
const category = [
"Videos",
"Music",
"Images",
"Gits",
]
function handleCategoryList(event){
setCategoryList(event.target.value)
console.log(event.target.value)
}
<Controller
control={control}
defaultValue=""
rules={{required: "Este campo es obligatorio"}}
render={({ field, fieldState }) => (
<>
<InputSelect {...field} onChange={handleCategoryList} value={categoryList}>
<option value="" defaultValue="" hidden>Choose an option</option>
{category.map((item, i) => (
<option value={item} key={i}>{item}</option>
))}
</InputSelect>
{fieldState?.error && <InputErrors>{fieldState.error?.message}</InputErrors>}
</>
)}
name="category"
/>
me sale este error.
react-dom.development.js:86 Warning: The value
prop supplied to
multiple
is false.Check the render method of styled.select
.
at select
at P2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=e4c3afae:1152:6)
at Controller (http://localhost:5173/node_modules/.vite/deps/react-hook-form.js?v=e4c3afae:292:35)
at div
at P2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=e4c3afae:1152:6)
at form
at P2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=e4c3afae:1152:6)
at section
at P2 (http://localhost:5173/node_modules/.vite/deps/styled-components.js?v=e4c3afae:1152:6)
at NuevoVideo (http://localhost:5173/src/components/main/section-new_video/NuevoVideo.jsx?t=1694212692294:22:30)
at RenderedRoute (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=e4c3afae:3327:5)
at Routes (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=e4c3afae:3780:5)
at RutasNavegacion
at MainContent
at div
at App
at Router (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=e4c3afae:3727:15)
at BrowserRouter (http://localhost:5173/node_modules/.vite/deps/react-router-dom.js?v=e4c3afae:4207:5)