scrimba
React Bootcamp Course
Speed Typing Game Part 3
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

Speed Typing Game Part 3
AboutCommentsNotes
Speed Typing Game Part 3
Expand for more info
App.js
run
preview
console
import React, {useState} from "react"

/**
* Challenge:
*
* Create a function to calculate the number of separate words in the `text` state
* For now, just console.log the word count when the button gets clicked to test it out.
*/

function App() {
const [text, setText] = useState("")

function handleChange(e) {
const {value} = e.target
setText(value)
}

return (
<div>
<h1>How fast do you type?</h1>
<textarea
onChange={handleChange}
value={text}
/>
<h4>Time remaining: ???</h4>
<button>Start</button>
<h1>Word count: ???</h1>
</div>
)
}

export default App
Console
/index.html
-7:17