final-form / react-final-form-arrays

A component for rendering and editing arrays 🏁 React Final Form
MIT License
205 stars 70 forks source link

React 16.13.0 Warning: `Cannot update a component...` warning on push mutator #126

Closed mikerudenko closed 4 years ago

mikerudenko commented 4 years ago

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

dominikzogg commented 4 years ago

https://github.com/final-form/final-form-arrays/issues/50

mikebarkmin commented 4 years ago

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: https://github.com/final-form/react-final-form/issues/751

mikerudenko commented 4 years ago

In the future, I think a better approach will be this lib- https://react-hook-form.com/ No render props, only hooks,

erikras commented 4 years ago

No render props, only hooks

@mikerudenko Also uncontrolled inputs, so no realtime validation. Engineering is a series of trade-offs.

erikras commented 4 years ago

Published a fix in react-final-form@6.4.0 and final-form@4.19.0. That should fix this issue.

Read more: https://github.com/final-form/react-final-form/issues/751#issuecomment-606212893