react-use-persistent
v1.0.3
Published
Persistent state made easy
Downloads
10
Readme
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