How to use the redux-recompose.wrapService function in redux-recompose

To help you get started, we’ve selected a few redux-recompose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Wolox / redux-recompose / example / src / services / HearthstoneService.js View on Github external
// Declare your api calls
const getCards = async () => new Promise(resolve => setTimeout(() => resolve(responseBody), 1000));

// Declare your customizations, used by fetchMiddleware
getCards.successSelector = response => response.cards;
getCards.injections = [
  withPostSuccess((dispatch, response, state) => alert(`Fetched at: ${state.hearthstone.count}`))
];

const service = {
  getCards
};

// Export your service by also specifying the reducer name and the target for each action.
export default wrapService(service, 'hearthstone', { getCards: 'cards' });

redux-recompose

A Redux utility belt for reducers and actions. Inspired by acdlite/recompose.

MIT
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis