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
It would be ideal to try to define the state as a union of the three above, and ensure proper type narrowing on every reducer case.
In the best case scenario, it should also be possible to narrow the types when consuming the state inside a component.
There also another use case, for actions which do not "happen" right away (like loading data), but have a "waiting" initial state, until the user actively performs an action (like saving on a form).
Currently there are some reducers containing async thunks which models look similar to this:
This interfaces combines the three possible async thunk states:
Pending:
Rejected:
Fulfilled:
It would be ideal to try to define the state as a union of the three above, and ensure proper type narrowing on every reducer case.
In the best case scenario, it should also be possible to narrow the types when consuming the state inside a component.
There also another use case, for actions which do not "happen" right away (like loading data), but have a "waiting" initial state, until the user actively performs an action (like saving on a form).
Waiting:
Pending:
Rejected:
Fulfilled:
The text was updated successfully, but these errors were encountered: