Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Created November 28, 2018 20:42
Show Gist options
  • Save mvbattan/6fffb2f73b9dd05925fee7da41a6b543 to your computer and use it in GitHub Desktop.
Save mvbattan/6fffb2f73b9dd05925fee7da41a6b543 to your computer and use it in GitHub Desktop.
Common reducer
import createReducer from '../../creators/createReducer';
import onLoading from '../../effects/onLoading';
import onSuccess from '../../effects/onSuccess';
import onFailure from '../../effects/onFailure';
// TODO: Let the user specify selectors
const reducerDescription = {
LOADING: onLoading(),
SUCCESS: onSuccess(),
FAILURE: onFailure()
};
export const defaultActionNames = Object.keys(reducerDescription);
// TODO: Let user specify this initialState
export default createReducer({}, reducerDescription);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment