formik-wizard icon indicating copy to clipboard operation
formik-wizard copied to clipboard

React warning: outdated lifecycle methods in some components

Open resolritter opened this issue 5 years ago • 2 comments

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 UNSAFE_componentWillMount 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 avatar Jul 03 '20 20:07 resolritter

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 avatar Jul 05 '20 01:07 resolritter

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

resolritter avatar Jul 06 '20 09:07 resolritter