I´m practicing the react challenges and it says it should be declared like this:
this.setState({
name: "React Rocks!"
})
I´m shocked why is not like this:
this.setState(){
name: "React Rocks!"
}
Or better because the previous one wouldn´t make 100% sense since “name” wouldn´t have global scope:
this.setState(){
this.state.name= "React Rocks!"
}
Why it has curly braces INSIDE parethensis? In my life I haven´t seen anything like that. Is not because it have to wrap it because of JSX since setState is declared outside return, so that doesn´t explain why,right?