Upgrade to v5.2.1 or higher and this open issue should be fixed yarn upgrade -L react-helmet
I think you need 16.3.1 or later, possibly 16.3.3
Answer from Nipun Ravisara on Stack Overflowreactjs - what's the use of getDerivedStateFromProps (or how do you fire it?) - Stack Overflow
Discussion: componentWillReceiveProps vs getDerivedStateFromProps
When should i use getDerivedStateFromProps?
How does `static getDerivedStateFromProps` work?
React always knows exactly what component instance it's currently rendering. But, in order to prevent potentially problematic usage patterns, yes, the getDerivedStateFromProps lifecycle method must be defined as static, so you cannot reference this inside. You're supposed to only look at the (latestProps, latestState) parameters, and determine what state updates if any are needed.
Videos
i don' t understand when i should use getDerivedStateFromProps() life-cycle method?
Please help me to understand this,Thank you...
I've been nailing myself on this, but as far as my knowledge goes, static methods can't access any instance, yet I see that this specific one, getDerivedStateFromProps, either returns the state so it can modify the state of your component, or null, if no changes are wanted.
So in order to sleep well tonight, I need to know how does this method access the instance in order to change the state?
React always knows exactly what component instance it's currently rendering. But, in order to prevent potentially problematic usage patterns, yes, the getDerivedStateFromProps lifecycle method must be defined as static, so you cannot reference this inside. You're supposed to only look at the (latestProps, latestState) parameters, and determine what state updates if any are needed.
The React internals call the static method at the same time they are updating the instance.
Something like this:
instance.props = newProps;
instance.setState(
TheClass.getDerviedStateFromProps(newProps)
);
The method does not access the instance. The React internals do.