scrimba
Frontend Career Path
React basics
Meme generator
Forms state object
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

AboutCommentsNotes
Forms state object
Expand for more info
Form.js
run
preview
console
import React from "react"

export default function Form() {
const [firstName, setFirstName] = React.useState("")
const [lastName, setLastName] = React.useState("")

function handleFirstNameChange(event) {
setFirstName(event.target.value)
}

function handleLastNameChange(event) {
setLastName(event.target.value)
}

return (
<form>
<input
type="text"
placeholder="First Name"
onChange={handleFirstNameChange}
/>
<input
type="text"
placeholder="Last Name"
onChange={handleLastNameChange}
/>
</form>
)
}
Console
/index.html
-6:09