0

I have a working auth flow for a React/Redux app, and I'm using reselect and redux-saga to handle state selection and async login/register functionality.

I have a single container that I've been using for testing, with login, register, logout all working. However, now I'm trying to figure out the "right" way to structure the app.

Should my login form and register form be their own containers with all functionality built in? If I do that, I find myself duplicating certain actions and code, such as the SET_AUTH action.

Is it "correct" to duplicate the code and separate the containers? Or is there some other way I'm missing?

Toby
  • 12,743
  • 8
  • 43
  • 75

1 Answers1

0

I ended up creating my authentication containers and reducers globally, in my root container (App.js), and then just dispatching actions from around my app - since the sagas are global they're always available, and simply wait for the dispatched actions.

For managing state per container I ended up using reselect to grab state slices from various parts of the app.

Toby
  • 12,743
  • 8
  • 43
  • 75