Note: these examples are React components using react-redux. Keep in mind that nothing in Redux Resource requires React: if you're using Redux with any other view layer, then this library will work just as well.
getStatus
getStatus
. This function facilitates using Redux Resource request statuses to build your interfaces. It will likely be one of the Redux Resource functions that you rely on the most.getStatus
makes a render function very expressive. It's also convenient that there aren't any checks for existence here, even though our data is nested in our store: the API of Redux Resource provides you with very predictable data.getStatus
calls in these situations, so that you can display information to the user as it becomes available. This way, if one endpoint is slow, or if the request fails entirely, the rest of the interface isn't affected by it.getStatus
to aggregate these calls together into status. The API for this is as follows:failed: true
, then the group is failed: true
.failed: true
, but at least one is pending: true
, then thepending: true
.succeeded: true
, then the group issucceeded: true
.true
.treatIdleAsPending
(the third argument, see below) is false
, then all three values will be false
if all of the request statuses in the state tree are "IDLE"
.treatIdleAsPending
getStatus
is a Boolean called treatIdleAsPending
. It determines whether a request status of "IDLE"
will count as pending
or not."IDLE"
.true
, then there will be a "flash of no content" unless you explicitly check for the "IDLE"
status yourself. To avoid this, pass treatIdleAsPending
as true, and getStatus
will instead consider that to be a pending state.treatIdleAsPending
is false
.treatIdleAsPending
:treatIdleAsPending
as true
treatIdleAsPending
as false