This package is intended to help you to build Redux actions and reducers for WordPress REST API endpoints. NPM: npm install redux-wordpress --save Yarn: yarn add redux-wordpress The package exports three function which you can use to create actions and build a reducer. Returns an object with a set of function which you can use to fetch data from REST API. name (string) - Arbitrary name which will be used in action types to distinguish different actions. host (string) - URL address to your API's root. Usually it will look like: http://mysite.com/wp-json/. endpoints (array) - A list of endpoints which you want to build actions for. It could be something like ['posts', 'categories']. namespace (string) - Optional. The namespace for your endpoints. By default it is wp/v2. Returns a reducer function which you can use to catch data returned by a fetch action. name (string) - A name which will be used to catch proper actions. It should be the same name as you passed to createActions function. Helper function which generates request functions to endpoints which you can use to group multiple requests into one action: host (string) - URL address to your API's root. Usually
Share This