Skip to content

Instantly share code, notes, and snippets.

@Bizunow
Last active September 26, 2017 12:25
Show Gist options
  • Save Bizunow/91e8617072d1711f741b832180cf5acc to your computer and use it in GitHub Desktop.
Save Bizunow/91e8617072d1711f741b832180cf5acc to your computer and use it in GitHub Desktop.
[React-Redux duck module] #js #react #redux
// Actions
const ACTION_1 = "my-app/social/ACTION_1";
// Dispatchers
export const dispatcher_1 = (data) => {
return (dispatch, getState) => {
dispatch({ type: ACTION_1, payload: data });
};
};
const initialState = {
data: null
};
export default (state = initialState, action) => {
switch (action.type) {
case ACTION_1: {
return { ...state, data: action.payload };
}
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment