Redux Resource Prop Types
A collection of prop-types objects.
Other Guides
Old Documentation
Migration Guides
Installation
Install redux-resource-prop-types
with npm:
npm install redux-resource-prop-types --save
Then, import the prop types that you need:
Usage
If you're using React, refer to the Typechecking with PropTypes guide on how to use the exported prop types. If you're not using React, refer to the documentation of the prop-types library.
We recommend using the prop types in this library to build your own prop types, which you can reuse throughout your application.
idPropType
idPropType
Validates a single resource ID.
Tip: This prop type requires that your IDs be either strings or numbers.
statusPropType
statusPropType
Validates the object returned by getStatus
.
requestStatusPropType
requestStatusPropType
Validates that a value is one of the requestStatuses
. Typically, you'll want to use statusPropType
instead, but this can be useful when verifying the structure of your slice.
resourcePropType
resourcePropType
Validates a resource. Similar to PropTypes.shape()
, except that it enforces an ID.
requestPropType
requestPropType
Validates a request object. Similar to PropTypes.shape()
, except that it enforces ids
, status
, requestKey
and resourceType
. Typically, you won't need to use this, but it can be useful to verify the structure of your state.
Last updated