scrimba
Learn React for free
React setState: Changing the State
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

React setState: Changing the State
AboutCommentsNotes
React setState: Changing the State
Expand for more info
App.js
run
preview
console
import React from "react"

class App extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
}

render() {
return (
<div>
<h1>{this.state.count}</h1>
<button>Change!</button>
</div>
)
}
}

export default App
Console
index.html
-12:15