LocalStorage
You may store the content of your reducers in LocalStorage with the kea-localstorage plugin.
Installation#
First install the kea-localstorage package:
Then install the plugin:
Configuration options#
The plugin takes the following options:
Usage#
note
To make a reducer persist in LocalStorage, your logic must have a path.
Use the babel-kea-plugin to
automatically generate paths for every logic.
Just add { persist: true } as an option to your reducers, and it will be stored:
note
Please be aware that under the hood kea-localstorage overrides the default value for the reducer with whatever was stored in localStorage. This means that any listeners hooked to any actions related to the reducer will not be triggered (this is also due to the fact that a reducer may have multiple actions, and there's no way of knowing which one to trigger).