Reputation: 203
What is a good way to structure redux state in a reactJS or reactNative application? Are there any guidelines as how to structure the state ? Is it dependent on the screens ? My application has 2 pages, login and account. Within account, I plan to show some graphs, and history and allow some simple transactions.
Upvotes: 0
Views: 638
Reputation: 15483
It is not dependent on the screens so much as it is dependent on your application state. Reducers produce your application state and your application state is what holds all of your data for your app.
Showing some graphs could be one of your reducers and showing history would be the other reducer. So it's not dependent on the screens per se, but the data that you will be displaying to the user.
Upvotes: 0
Reputation: 366
I would say you should refer to Dan Abramov's(the creator of redux) course in egghead(which is free) for redux structure and guidlines. Redux Course.
As to your other question. No redux state is not screen dependent. Redux is independent of react or screens. So your redux state can be use with any UI(React, Angular etc...). Basically Redux is a giant state that is the result of bunch of reducers. I would really recommend Dan Abramov's course if you're new to Redux.
Upvotes: 2