componentWillReceiveProps
is always invoked in shallow
, even getDerivedStateFromProps exists
#1692
Closed
1 of 3 tasks
Description
As I tested, the
componentWillReceiveProps
will always be invoked when after callingshallowWrapper.setProps()
, even thoughgetDeriveStateFromProps
exists. But referred to this, all the UNSAFE lifecycle methods should not be invoked whengetDerivedStateFromProps
exists.By the way,
componentWillUpdate
andcomponentWillMount
behaves correctly inshallow
.And, for
mount
, all the UNSAFE methods won't be invoked when component havegetDerivedStateFromProps
methodCode
I am expecting the tests to pass, but the result shows that

expect(componentWillReceivePropsSpy).not.toHaveBeenCalled();
failed.Your environment
API
Version
The text was updated successfully, but these errors were encountered: