Redux
- Use Immutable.js for non-primitives, such as lists, objects, maps, etc.
- Store keys of Immutable.js values should be named with prefix
$$
Store should be of the shape:
export type StoreType = {
$$commentsStore: $$Map<string, any>,
$$profileStore: $$Map<string, any>,
};
Action Creators
This is boilerplate code that creates Redux “actions”. These a functions to initiate a mesasge to Redux, which can update the store via reducers, kick off a redux saga, trigger other middleware, etc.
Each action creator has the following parts:
- actionType: Unique string which identifies the action. All the redux listeners will use this actionType.
- List of param values.
Constants
/bundle/constants/actions.js
: Contains both apiActionNames
and storeActionNames
. Api Actions are handled by some boilerplate for sending a basic post request to the server.
Selectors
Functions of the form (flow syntax)
(store: {}) => {}
Notes:
- Store contains Immutable.js
- Selectors convert Immutable, like this:
(store) => store.$$somePartOfStore.toJS()
- Note that we know that toJS is on the
$$somePartOfStore
, as it’s named with the$$
Sagas
Coming soon…