Skip to content

Instantly share code, notes, and snippets.

@jacobp100
Last active July 15, 2016 09:47
Show Gist options
  • Select an option

  • Save jacobp100/6fb6b93f3431fe0dbfe75c9534beb9fd to your computer and use it in GitHub Desktop.

Select an option

Save jacobp100/6fb6b93f3431fe0dbfe75c9534beb9fd to your computer and use it in GitHub Desktop.
import serialize from 'form-serialize';
import actionCreators from './actionCreators';
export const formDispatcher = dispatch => event => {
event.preventDefault();
const actionParams = serialize(event.currentTarget, { hash: true, empty: true });
const actionCreator = actionCreators[actionParams['action-creator']];
const action = actionCreator(actionParams);
dispatch(action);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment