-
-
Notifications
You must be signed in to change notification settings - Fork 14
Mount issue on RHFInput #4
Comments
was this issue caused during unmount? any chance i could have a codesandbox to reproduce? |
you want to upgrade the latest react hook form? see if that error goes away |
This happens when the props of the component changes, that is after a re-render. I can say setValue={setValue} is causing the issue. |
Bump it just now. No help!! :( |
do you have a codesandbox for this particular issue? |
why |
Its a github bug. Its not showing the "input " |
oh why you are using this component with native input?
|
@bluebill1049 am clear now only after I prepare for a code sandbox. For example, I used native input, else am using reactstrap ui lib. Also, I found what the problem is. It's my mistake in my code. Nothing related to react hook form. here if isFetching props is true, then RHFInput is unmounted, that caused the issue. |
no worries mate @ajay-dev-j |
Hello developers, am facing this issue. I am new to this repo.
I like to share the code without the UI library. Just an input is enough to replicate the issue. Once the component is re-rendered and then we try to update the input, we are getting a warning, which is ugly. Can anyone please help me with this.
Code snippet
<RHFInput
as={ }
defaultValue={getValues().email}
rules={
{
required: 'Email is required',
pattern : {
value: /^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/,
message: 'Bad email'
}
}
}
name='email'
placeholder='Enter Email'
register={register}
setValue={setValue}
/>
Error on change after re-render,
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
in Unknown (at LoginComponent.js:70)
in div (created by FormGroup)
in FormGroup (at LoginComponent.js:68)
in form (created by Form)
in Form (at LoginComponent.js:67)
The text was updated successfully, but these errors were encountered: