react-with-direction
react-with-direction copied to clipboard
Updates DirectionProvider to use componentDidUpdate instead of UNSAFE_componentWillReceiveProps
This change migrates DirectionProvider to cease using UNSAFE_componentWillMount in favor of componentDidUpdate in accordance with
If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead. from: https://reactjs.org/docs/react-component.html
Unfortunately, since Enzyme lacks support for shallow mounting that fires componentDidUpdate, there is also a tangential change that includes jsdom as the environment that DirectionProvider's test is run in. And further, because this causes a warning to appear in the test regarding requestAnimationFrame, I used a method found in this thread to quell the warning: https://github.com/facebook/jest/issues/4545
One last thing to note: Some of the testing here was switched to mount in favor of shallow. This was to accommodate an ongoing issue with Enzyme being unable to trigger a call to cDU with setProps being called on a shallow wrapper. https://github.com/airbnb/enzyme/issues/1452