other-emerald
other-emerald•2y 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•2y 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•2y 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•2y ago
<@128446913274970112> kapa.ai is still learning and improving, please let us how it did by reacting below
other-emerald
other-emerald•2y ago
@kapa.ai you are hallucinating the newest version of @refinedev/react-hook-form is 4.1.0. Nice try though!
Omer
Omer•2y 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!
other-emerald
other-emerald•2y 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•2y ago
Thank you! You're rock 🔥
other-emerald
other-emerald•2y ago
FYI, works just changing to import { Controller } from "react-hook-form"; which is great as I can crack on.
rival-black
rival-black•2y ago
Hello @johnwards, PR fixing the issue is merged 🎉 Stay tuned for the release Hello @johnwards, fix version is released 🚀