A higher order function that wraps React components saving their state in persistent localStorage. Similar to react-localstorage but implemented as a higher order component
npm install marklundin/react-localstorage-hoc
import persist from 'react-localstorage-hoc'
class Counter extends React.Component{
render(){
let { counter } = this.state
return <div
onClick={ e => this.setState({counter:counter+1 })}>{'Clicked ' + counter + ' times'}</div>
}
}
export default persist( Counter )