use-synced-local-storage
v1.0.2
Published
Custom react hook for cross-synced local storage
Downloads
43
Readme
use-synced-local-storage
Custom react hook for synced local storage, listens to manual or cross-tab changes and updates accordingly
Install
npm install --save use-synced-local-storage
Usage
import React from "react";
import { useSyncedLocalStorage } from "use-synced-local-storage";
const App = () => {
const [storage, setStorage] = useSyncedLocalStorage("storage-key", 1);
return (
<>
{storage}
<button onClick={() => setStorage(storage + 1)}>click me</button>
</>
);
};
export default App;
License
MIT © berkeatac
This hook is created using create-react-hook.