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