Skip to content

Instantly share code, notes, and snippets.

@alexesDev
Last active July 20, 2017 15:47
Show Gist options
  • Select an option

  • Save alexesDev/d9de9f3f39e98bef8ac09c255c865756 to your computer and use it in GitHub Desktop.

Select an option

Save alexesDev/d9de9f3f39e98bef8ac09c255c865756 to your computer and use it in GitHub Desktop.
fetch('http://...')
.then(res => res.json())
.then(data => dispatch(autodux.actions.success(data)));
const json = res => res.json();
const success = data => dispatch(autodux.actions.success(data)); // <----
fetch('http://...')
.then(json)
.then(success);
const json = res => res.json();
const success = compose(dispatch, autodux.actions.success); // <----
fetch('http://...')
.then(json)
.then(success);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment