-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning: Can't call setState on a component that is not yet mounted #174
Comments
Please try find answer there - #92 |
I already looked at that issue. I don't think it has the solution to my problem. The link mentioned in that issue suggests a solution for error occurring because of async tasks. But in the repo that I have linked above I do not have any async task running. All I have is a simple Form Builder, a Form Render & a Demobar component in my code. So the warning could not have come from an async task. |
RisingStack/react-easy-state#196 (comment) |
I think I might have figured out why this is happening. This might have to do with the handling of the code related to the subscription in the library. Below is a link for reference: So I tried to implement this. As you can see in the image below, I was getting error in three files of React FormBuilder library - Demobar, Preview, and Toolbar. As you can see in the image below, in the Demobar.js file, the code related to the subscription is also present inside the So, in the Demobar.js file, I moved that code to the Can you please move the lines related to the subsciption, in the Preview.jsx & Toolbar.jsx files, to the Thank You. |
Looks like that was the reason of warning, Thanks. |
I am getting
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.
warning in my console (See attached image below) -I have reproduced the same warning message in my GitHub repo linked below:
https://github.com/kart1ka/form-builder
Just download the code and run
npm install
and thennpm start
and you will see the warning message in the console.The message says that the error is coming from the Preview file of the React Form Builder-2 library.
Can you please take a look at it?
Thank You.
PS - The warning disappears when the
<React.StrictMode>
is removed from index.js file.The text was updated successfully, but these errors were encountered: