redux-devtools icon indicating copy to clipboard operation
redux-devtools copied to clipboard

React-json-tree: Update UNSAFE_componentWillReceiveProps lifecycle hook.

Open BrunoFenzl opened this issue 3 years ago • 3 comments

I could not find any related issues, so please forgive me if this was already addressed somewhere. React throws following warning when using react-json-tree:

Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state

Please update the following components: JSONNestedNode, JSONTree

I believe I could fix this and update those components. Is this in your roadmap?

BrunoFenzl avatar Sep 16 '20 07:09 BrunoFenzl

What version of react-json-tree are you using? It should be fixed in [email protected] by https://github.com/reduxjs/redux-devtools/pull/483.

Methuselah96 avatar Sep 16 '20 13:09 Methuselah96

I'm using version 0.13.0. The PR #483 just updates the deprecation messages using UNSAFE_componentWillReceiveProps instead of implementing getDerivedStateFromProps. I propose updating those comps with the new static method.

BrunoFenzl avatar Sep 16 '20 14:09 BrunoFenzl

Oh, I see, sorry, I read the issue too fast. Yeah, it's worth fixing, so PRs are welcome. Eventually I will get to it myself, but it's not the highest priority right now.

Methuselah96 avatar Sep 16 '20 14:09 Methuselah96