React 16.13.0 Warning: `Cannot update a component...` warning on push mutator
mikerudenko opened this issue · 5 comments
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
When I trying to trigger the push method to add f.e. todo item in my array I see this warning
Warning: Cannot update a component from inside the function body of a different component.
What is the expected behavior?
No warning. On version 16.12.0 no warning happened
What's your environment?
Chrome 80
MacOS Catalina
React
16.13.0
React 16.13.0 introduced a new warning: https://reactjs.org/blog/2020/02/26/react-v16.13.0.html#warnings-for-some-updates-during-render
This warning is also discussed in react-final-form: final-form/react-final-form#751
In the future, I think a better approach will be this lib- https://react-hook-form.com/
No render props, only hooks,
No render props, only hooks
@mikerudenko Also uncontrolled inputs, so no realtime validation. Engineering is a series of trade-offs.
Published a fix in react-final-form@6.4.0 and final-form@4.19.0. That should fix this issue.
Read more: final-form/react-final-form#751 (comment)