scrimba
React Bootcamp Course
Custom Hooks
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

Custom Hooks
AboutCommentsNotes
Custom Hooks
Expand for more info
App.js
run
preview
console
import React, {Component} from "react"
/**
* Pop Quiz!
*
* Refactor the class component below to use hooks instead
*/


class App extends Component {
state = {
count: 0
}

increment = () => {
this.setState(prevState => ({count: prevState.count + 1}))
}

render() {
return (
<div>
<h1>The count is {this.state.count}</h1>
<button onClick={this.increment}>Add 1</button>
</div>
)
}
}

export default App
Console
/index.html
-10:22