Skip to content

Instantly share code, notes, and snippets.

@AkshayRana92
Last active August 16, 2017 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayRana92/d327799bbbd7a21df24659a1b9019a0b to your computer and use it in GitHub Desktop.
Save AkshayRana92/d327799bbbd7a21df24659a1b9019a0b to your computer and use it in GitHub Desktop.
state1
import React, { Component } from 'react';
class MyComponent extends Component {
constructor() {
super();
this.state= {name: 'Say my name'};
setInterval(
() => {
this.setState({name: 'Heisenberg'})
},
2000
);
}
render() {
return (
<h1>{this.state.name}</h1>
);
}
}
export default MyComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment