Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 693 Bytes

File metadata and controls

23 lines (20 loc) · 693 Bytes

withPreFetch

The withPreFetch injector allows to inject behaviour before the service call. This injector is not thought for normalizing/denormalizing data. If this is the intention, use you normalizing/denormalizing function on the payload property as shown below:

Example:

 import { withPreFetch } from 'redux-recompose';	
  const actionCreators = {	
   someAction: data => ({	
     type: actionType,	
     target: someTarget,	
     service: someService,	
     payload: denormalize(data),	
     injections: [	
       withPreFetch(dispatch => {	
           /* you can dispatch other actions before the service call */	
       })	
     ]	
   })	
 };