State - ProtonMail/proton-pack GitHub Wiki
State
We will use Redux to manage global state. Global state is:
- Any model that can be updated by the event manager.
- Any model that is used in different parts of the application.
- Examples: Notifications, UserModel, KeysModel, AddressesModel, UserSettingsModel, etc.
We will also use redux to manage complex logic. We will use the redux-thunk middleware to handle asynchronous actions. Examples of complex logic is the sign in and sign up.
Having the state, actions and business logic in Redux allows us to easily change the view layer since Redux can be hooked up to most Javascript frameworks and libraries.
Currently we use connect to create the subscription between React and Redux, but we will use hooks when it is released.
Other than that, if the state is not global, it should be kept inside the container or presentational component.