where to put react redux thunk function code example
Example 1: thunk redux
npm install --save redux-thunk
Example 2: redux-thunk example
const INCREMENT_COUNTER = 'INCREMENT_COUNTER';
function increment() {
return {
type: INCREMENT_COUNTER
};
}
function incrementAsync() {
return dispatch => {
setTimeout(() => {
// You can invoke sync or async actions with `dispatch`
dispatch(increment());
}, 1000);
};
}