Last active
April 3, 2018 23:09
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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