Open yudielcurbelo opened 4 months ago
Thank you @yudielcurbelo for opening this issue. Also adding link to original issue which was incorrectly transferred to the devtools repo.
Here is a sample of the same error with data binding via values property.
The source code: react-hook-form-devtool-issue.zip react-hook-form: 7.51.1 - 7.51.3 @hookform/devtools: 4.3.1
function App() {
const { control, register, handleSubmit } = useForm({
values: { firstName: 'John' } // <-- causes error "Cannot update a component (`DevTool`) while rendering a different component (`Controller`)."
});
const onSubmit = (data: unknown) => {
alert(JSON.stringify(data));
};
return (<>
<form onSubmit={handleSubmit(onSubmit)}>
<div>
<label htmlFor="firstName">First Name</label>
<input placeholder="first name" {...register("firstName")} />
</div>
<input type="submit" />
</form>
<DevTool control={control} />
</>);
}
Also facing this issue, had to remove devtools from my forms 😕
Same here
Same here! Any updates on this?
Same here..I thought my form components was bad and waste a lot of time debugging it...
Version Number
7.51.3
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/nervous-nova-mjw92s?file=%2Fsrc%2FApp.tsx
Steps to reproduce
Expected behaviour
This warning is not present on 7.51.0 but is in 7.51.1 and current.
There should not be any warning.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Code of Conduct