Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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