scrimba
Learn React
Writing Modern React Apps
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

Writing Modern React Apps
AboutCommentsNotes
Writing Modern React Apps
Expand for more info
App.js
run
preview
console
import React, {Component} from "react"

class App extends Component {
// Change to use class properties
constructor() {
super()
this.state = {
firstName: ""
}
this.handleChange = this.handleChange.bind(this)
}

// Change to use arrow functions
handleChange(event) {
const { name, value } = event.target
this.setState({
[name]: value
})
}

render() {
return (
<main>
<form>
<input
type="text"
name="firstName"
value={this.state.firstName}
onChange={this.handleChange}
placeholder="First Name"
/>
</form>
<h1>{this.state.firstName}</h1>
</main>
)
}
}

export default App


/**
* Other modern/advanced React features/topics to learn:
*
* Official React Context API - https://reactjs.org/docs/context.html
* Error Boundaries - https://reactjs.org/docs/error-boundaries.html
* render props - https://reactjs.org/docs/render-props.html
* Higher Order Components - https://reactjs.org/docs/higher-order-components.html
* React Router - https://reacttraining.com/react-router/core/guides/philosophy
* React Hooks - https://reactjs.org/docs/hooks-intro.html
* React lazy, memo, and Suspense - https://reactjs.org/blog/2018/10/23/react-v-16-6.html
*/
Console
index.html
-6:03