I have a monorepo React setup built using lerna tool where I have one package that is storing the Redux state and exports createStore
method. There is also one custom hook:
import {useSelector} from 'react-redux';
export const useSignInEffect = (effect: EffectCallback) => {
const isSignedIn = useSelector((state: RootState) => state.auth.isSignedIn);
useEffect(() => {
if (isSignedIn) {
return effect();
}
}, [isSignedIn]);
};
Everything else works well, redux store besides this hook where I get the following error. Do I need to do something additional here?
This most commonly means that your build system is pulling in multiple copies of react
or react-redux
. Make sure that any "library"-type packages are set to use react
and react-redux
as peer dependencies, not full dependencies, and that only one copy of each is in your app bundle.