https://www.youtube.com/watch?v=qh3dYM6Keuw
- by default is null so you can set it to what you want
- only place you set your initial state is in constructor
- whenever state changes it will rerender and update the DOM it will only updated affected node no lets see how we change it
- go in the render method then you can change the set for ex:
- React take care of DOM manipulation for us.
- Use State --> only get used when component has internal value and that only affect that component.
render() {
setTimeout(() => {
this.setState({name:"BoB"});
}, 1000)
constructor () {
super()
this.state = {name: "Will }
}
then you can access this by entering this states name so -->
render() { return (
{this.state.name}
);
}