Skip to content

Instantly share code, notes, and snippets.

View jayendrasharan's full-sized avatar

Jayendra Sharan jayendrasharan

View GitHub Profile
@jayendrasharan
jayendrasharan / simulate-async.js
Last active December 6, 2019 20:08
Simulating an async action using thunk
/**
* In redux environment, when we deal with async calls, we cannot use the dispatch to dispatch a
* a plain action. An action creator in redux is a pure function which returns
* an object with action type (must have) and necessary payload.
* See following example.
*/
// actions.js
// action creator to dispatch an add todo action