Skip to content

Instantly share code, notes, and snippets.

@Salman18
Created October 30, 2017 11:01
Show Gist options
  • Save Salman18/1090fb3bd5fbc72c3fcee8d4b32b3d66 to your computer and use it in GitHub Desktop.
Save Salman18/1090fb3bd5fbc72c3fcee8d4b32b3d66 to your computer and use it in GitHub Desktop.
const reducer = ( state = [],action) => {
if (action.type === 'split_string') {
return action.payload.split('');
}
return state;
};
const store = Redux.createStore(reducer);
store.getState();
const action = {
type: 'split_string',
payload: 'AMCAT'
};
store.dispatch(action);
store.getState();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment