Skip to content

EricRabil/react-use-persistent

Repository files navigation

react-use-persistent

Persistent state made easy

Install

npm install --save react-use-persistent

Usage

import React, { Component } from 'react'

import { usePersistent } from 'react-use-persistent'

function MyComponent() {
  const [ setting, setSetting ] = usePersistent("localstorage-key", false);

  return (
    <input type="checkbox" checked={setting} onChange={event => setSetting(event.target.checked)} />
  )
}

License

MIT © EricRabil

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published