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. 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.
getStatusmakes 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.
getStatuscalls 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.
getStatusto aggregate these calls together into status. The API for this is as follows:
failed: true, then the group is
failed: true, but at least one is
pending: true, then the
succeeded: true, then the group is
treatIdleAsPending(the third argument, see below) is
false, then all three values will be
falseif all of the request statuses in the state tree are
getStatusis a Boolean called
treatIdleAsPending. It determines whether a request status of
"IDLE"will count as
true, then there will be a "flash of no content" unless you explicitly check for the
"IDLE"status yourself. To avoid this, pass
treatIdleAsPendingas true, and
getStatuswill instead consider that to be a pending state.