1.0.0 • Published 2 years ago

persist-local-variable v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Persist Local Variable

React package to make local variable persist on multiple session.

Getting Started

Instalation

// Yarn
yarn add --dev persist-local-variable

// NPM
npm install --save-dev persist-local-variable

Usage

import {
  usePersistLocalVariable,
  set,
  remove,
  get,
} from "persist-local-variable";

const App = () => {
  // Call this hook in the app root
  usePersistLocalVariable();

  return (
    <>
      <button onClick={() => set("Test Data")}>Set</button>
      <button onClick={() => remove()}>Remove</button>
      <button onClick={() => console.log(get())}>Show</button>
    </>
  );
};