Add expiration to your persisted store
npm install redux-persist-transform-expire
Add expiration to your persisted store.
``js
import createExpirationTransform from 'redux-persist-transform-expire';
const expireTransform = createExpirationTransform({
expireKey: 'customExpiresAt',
defaultState: {
custom: 'values'
}
});
persistStore(store, {
transforms: [expireTransform]
});
``
| Attr | Type | Default | Notes |
| ------------ | ------ | ------------------ | --------------------------------------------------- |
| expireKey | String | 'persistExpiresAt' | Name of the attribute holding the expire date value |
| defaultState | Any | {} | Shape of the state after expirations happen |