Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save selbekk/a0d9985121f7f695d6c1101f2a8f3308 to your computer and use it in GitHub Desktop.

Select an option

Save selbekk/a0d9985121f7f695d6c1101f2a8f3308 to your computer and use it in GitHub Desktop.
A simple dispatcher
import * as actions from '../actions';
const getUser = () => async dispatch => {
dispatch(actions.getUserRequested());
const response = await fetch('/api/user');
const user = await response.json();
dispatch(actions.getUserReceived(user);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment