You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An action informing the reducers that the request began.
The reducers may handle this action by toggling an isFetching flag in the state. This way the UI knows it's time to show a spinner.
An action informing the reducers that the request finished successfully.
The reducers may handle this action by merging the new data into the state they manage and resetting isFetching. The UI would hide the spinner, and display the fetched data.
An action informing the reducers that the request failed.
The reducers may handle this action by resetting isFetching. Additionally, some reducers may want to store the error message so the UI can display it.
Pay close attention to the shape of the state (how you're storing the information) before starting your implementations because async actions require a lot of state changes
Redux thunk
Redux Thunk makes it easy to dispatch actions that follow the lifecycle of a request to an external API.