Synchronize React component state with local storage
- Published on
- Published on
- /2 mins read/---
Simple custom hook to synchronize component state with local storage.
In some cases, you might need to check for browser environment, cause local storage is available only in the client side.
Usage
A simple example of using the hook to synchronize component state with local storage is shown below: