Skip to content

Instantly share code, notes, and snippets.

@adamTrz
Created February 20, 2017 19:13
Show Gist options
  • Select an option

  • Save adamTrz/6f283ad6038786314e9089f85e8c97e3 to your computer and use it in GitHub Desktop.

Select an option

Save adamTrz/6f283ad6038786314e9089f85e8c97e3 to your computer and use it in GitHub Desktop.
//App.js:
...
connect(mapStateToProps, { fetchData })(App)
//ActionCreator:
export const fetchData = () => (dispatch) => {
dispatch({type: FETCHING_DATA})
getPeople()
.then(data => dispatch({type: FETCHING_DATA_SUCCESS, payload: data}))
.catch(er => dispatch({type: FETCHING_DATA_FAILURE}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment