vicious-gold
vicious-gold•17mo ago

Module '"@refinedev/react-hook-form"' has no exported member 'Controller'.

Hey, so I've copied out the code generated by MuiCreateInferencer for my edit page. For one of my fields, which is called isActive, it's generated the following code. import { useForm, Controller } from "@refinedev/react-hook-form"; <Controller control={control} name="isActive" // eslint-disable-next-line defaultValue={null as any} render={({ field }) => ( <FormControlLabel label="Is Active" control={ <Checkbox {...field} checked={field.value} onChange={(event) => { field.onChange(event.target.checked); }} /> } /> )} /> But Controller isn't in react-hook-form it seems? Using v4 FYI.
9 Replies
kapa.ai
kapa.ai•17mo ago
Hey @johnwards! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
kapa.ai
kapa.ai•17mo ago
---------------------- It looks like you are using version 4 of @refinedev/react-hook-form. The Controller component was introduced in version 5. You can upgrade to version 5 by running npm install @refinedev/react-hook-form@5.0.0 in your terminal. For more information, please refer to the React Hook Form documentation (https://react-hook-form.com/api#Controller). ----------------------
API Documentation
Performant, flexible and extensible forms with easy-to-use validation.
kapa.ai
kapa.ai•17mo ago
<@128446913274970112> kapa.ai is still learning and improving, please let us how it did by reacting below
vicious-gold
vicious-gold•17mo ago
@kapa.ai you are hallucinating the newest version of @refinedev/react-hook-form is 4.1.0. Nice try though!
Omer
Omer•17mo ago
Oops, yes you're right, the Controller should have been imported from the "react-hook-form" package. Also, could you create a GitHub issue for this problem so that I can address it with my teammate? Thank you for your understanding!
vicious-gold
vicious-gold•17mo ago
GitHub
[BUG] Controller being imported incorrectly from @refinedev/react-h...
Describe the bug Hey, so I&#39;ve copied out the code generated by MuiCreateInferencer for my edit page. For one of my fields, which is called isActive, it&#39;s generated the following cod...
Omer
Omer•17mo ago
Thank you! You're rock 🔥
vicious-gold
vicious-gold•17mo ago
FYI, works just changing to import { Controller } from "react-hook-form"; which is great as I can crack on.
fair-rose
fair-rose•17mo ago
Hello @johnwards, PR fixing the issue is merged 🎉 Stay tuned for the release Hello @johnwards, fix version is released 🚀