I have an react app using redux where every container handles its own state.
However, I have some global states that I'm having a hard time deciding how to manage. The main one is everything having to do with authentication.
I want every container in my app have access to logged-in user's info, to the access and refresh tokens, etc. I also want certain authentication operations (say, refreshing a token, or logging out) to be available for dispatching throughout the app.
I ended up created a container that deals with everything Authentication (that has its own constants, actions, reducers, selectors and sagas). As such, whenever I want to dispatch an authentication operation (say, logout) I can do it from every page, just be importing the authentication reducer and actions.
My problem is that now, for every container on the app I have 2 sets of reducers, actions, etc: Those that belong directly to container that is currently active (say, user profile), and those that belong to the global app's authentication state (see below).
I feel like this goes against the principal of Separation of Concerns, but I have pulling hairs trying to figure out how to structure this.
Since authentication is such a basic element most web-apps, I am sure there's a "right way" of doing it, but my searches are not yielding any fruits.
Can anyone help? I'd love any tip or resource that may help.
