Skip to content

Instantly share code, notes, and snippets.

View Mehdih77's full-sized avatar
:electron:
Working from home

Mehdi Mehdih77

:electron:
Working from home
View GitHub Profile
@umayr
umayr / multiple-api-calls-redux-thunk.js
Created December 1, 2016 21:43
Multiple API calls with Redux Thunks.
function doSomething() {
return dispatch =>
fetch(
'/api/something'
).then(
response => response.json()
).then(
json => dispatch({ type: DO_SOMETHING, json }),
err => dispatch({ type: SOMETHING_FAILED, err })
);