@phenomenon-hooks/use-local-storage
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

useLocalStorage


Installation

yarn add @phenomenon-hooks/use-local-storage

or

npm i @phenomenon-hooks/use-local-storage

Usage

import React from 'react';
import { useLocalStorage } from '@phenomenon-hooks/use-local-storage';

const Component: React.FC = () => {
    const [value, setValue] = useLocalStorage('key', 'value');

    return (
        <div>
            <p>Value: {value}</p>
            <button
                onClick={() => {
                    setValue('new value');
                }}
            >
                Set new value
            </button>
        </div>
    );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @phenomenon-hooks/use-local-storage

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

10.5 kB

Total Files

8

Last publish

Collaborators

  • mykola.kolomoyets