zaguiini / formik-wizard

A multi-step form component powered by formik and react-albus
MIT License
86 stars 26 forks source link

React warning: outdated lifecycle methods in some components #31

Open resolritter opened 4 years ago

resolritter commented 4 years ago

From the DevTools' Console tab

Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

  • Move code with side effects to componentDidMount, and set initial state in the constructor.
  • Rename componentWillMount to UNSAFEcomponentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.

Please update the following components: Steps, Wizard

resolritter commented 4 years ago

Wait, I took a look at the code now and noticed those components are exported from react-albus. There isn't a way to refactor them nicely without forking the library.

Someone recently contributed a commit which should get rid of this warning https://github.com/americanexpress/react-albus/commit/528d735a8336b8072d13e3d059d27fc8a02b650b, thus the solution would be to simply bump react-albus' version. However, I've looked at the package's page

https://www.npmjs.com/package/react-albus

And there doesn't seem to be any activity there.

@zaguiini are you open to adding react-albus as a git dependency until this is sorted out? Or am I missing something about how NPM works?

Another option would be to migrate to a library which's actually maintained, as react-albus's repo seems to have staled in development. I might try that in an MR.

resolritter commented 4 years ago

https://github.com/zaguiini/formik-wizard/pull/32 indirectly solves this by replacing react-albus with react-step-wizard, which is actually maintained