Answers for "redux-thunk action creator"

0

redux-thunk action creator

/* Redux-Thunk Action Creator */
const createAction = () => { type: 'ACTION_TYPE' };

function createAsyncAction() {
	return (dispatch) => {
		setTimeout(() => {
      		dispatch(createAction());
          	/* ^ invoke sync or async actions with dispatch */
    	}, 1000);
	}
}

/* About Redux-Thunk Actions
 * redux-thunk allows you to write action creators
 * that return a function instead of an action
 */
Posted by: Guest on March-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language