Last active
December 15, 2017 14:08
-
-
Save isavch/b73eaeb6c9c85df7d33e29565c8d4d43 to your computer and use it in GitHub Desktop.
api2
This file contains hidden or 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
| /* API usage */ | |
| import initApi from 'redux-wp'; | |
| initApi(store); | |
| /* Somewhere in the user code */ | |
| import getPost from 'wp-redux' | |
| getPost(2, 'posts') | |
| .then(post => console.log(post)); | |
| /* Implementation */ | |
| import getPostFactory from './getPost'; | |
| let store = null; | |
| export function init(store) { | |
| store = store; | |
| } | |
| export const getPost = getPostFactory(store); | |
| export const getTaxonomies = getTaxonomiesFactory(store) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment