Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidgilbertson/3ae5b5a77d3d5c1d7513f5f39de487ad to your computer and use it in GitHub Desktop.
Save davidgilbertson/3ae5b5a77d3d5c1d7513f5f39de487ad to your computer and use it in GitHub Desktop.
fetch(`/api/search?${queryParams}`)
.then(response => response.json())
.then(normalizeSearchResultsApiData) // the do-it-all data massager
.then(normalData => {
// dispatch normalData to the store here
});
@jfbrennan
Copy link

jfbrennan commented May 5, 2017

Just finished your article (good writeup btw). Why not use Backbone? parse and fetch make this much cleaner:

search.fetch({data: queryParams}).then(dispatchToStore);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment