I am trying to implement authentication flow with Redux in my app, I am using conditional rendering in my App.js file to show either app screen or authentication screen.
App.js:
<Provider store={store} >
<NavigationContainer>
{store.getState().auth.initializing && <Initializing />}
{store.getState().auth.isLoggedIn && (
<AppNavigator/>
)}
{!store.getState().auth.initializing &&
!store.getState().auth.isLoggedIn && (
<AuthenticationNavigator/>
)}
</NavigationContainer>
</Provider>
The problem is it doesn't react on changes in the state, when I press Login button on the login screen even though redux refreshes the state, the conditional rendering in App.js doesn't react anyhow and I still see login screen. If I use useState with isUserLoggedIn flag in the App.js, and pass callback to the components it works, but not with Redux.
Please help, what do I do wrong?