Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Last active April 3, 2018 23:09
Show Gist options
  • Save jamesplease/a15001a850cc0047e27dd0a5fe41be5a to your computer and use it in GitHub Desktop.
Save jamesplease/a15001a850cc0047e27dd0a5fe41be5a to your computer and use it in GitHub Desktop.
Sometimes, data is distributed across multiple APIs. You may want an abstraction layer for dealing with this.
const fetchBook = createFetcher(
(options) => {
return fetch(`/books/${options.bookId}`);
},
{
attributeFetchers: {
author(bookId) {
return getAuthorForBookId(bookId)
}
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment