use-synced-local-storage
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/use-synced-local-storage package

1.0.2 • Public • Published

use-synced-local-storage

Custom react hook for synced local storage, listens to manual or cross-tab changes and updates accordingly

NPM JavaScript Style Guide

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.

/use-synced-local-storage/

    Package Sidebar

    Install

    npm i use-synced-local-storage

    Weekly Downloads

    38

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    1.36 MB

    Total Files

    23

    Last publish

    Collaborators

    • berkeatac