From what I am experiencing so far, it doesn\'t seem like ReactJS updates with the state of localStorage. My code below.
var Frr = React.createClass({
getIni
Here is just another Example:
import React from 'react'
class App extends React.Component {
constructor(props) {
super(props);
var storedClicks = 0;
if (localStorage.getItem('clicks')) {
storedClicks = parseInt(localStorage.getItem('clicks'));
}
this.state = {
clicks: storedClicks,
};
this.click = this.click.bind(this);
}
click() {
var newclick = this.state.clicks + 1;
this.setState({clicks: newclick});
// Set it
localStorage.setItem('clicks', newclick);
}
render() {
return (
Click the button a few times and refresh page
Counter {this.state.clicks}
);
}
}
export default App;