Description
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
react-redux/src/hooks/useSelector.js
Lines 22 to 27 in 2eac861
react-redux/src/components/connectAdvanced.js
Lines 40 to 45 in 6725400
These two files implement the useIsomorphicLayoutEffect
hook to prevent the React warning by using useEffect
instead of useLayoutEffect
. But it could break on non-web environment, like React Native, and etc.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to a CodeSandbox (https://codesandbox.io/s/new) or RN Snack (https://snack.expo.io/) example below:
I tested by these steps:
- Clone the
react-redux
repo - Modify
useIsomorphicLayoutEffect
toconst useIsomorphicLayoutEffect = useEffect
- Run
npx jest
What is the expected behavior?
- We should add some test cases for non-web environment. For example @testing-library/react-native provides the way to test
react-native
in jest. - We should review the implement of
useIsomorphicLayoutEffect
and fix it if there did have some bugs.
Which versions of React, ReactDOM/React Native, Redux, and React Redux are you using? Which browser and OS are affected by this issue? Did this work in previous versions of React Redux?
react-redux@7.1.1
cc