scrimba
React Bootcamp Course
Speed Typing Game Intro
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 Intro
AboutCommentsNotes
Speed Typing Game Intro
Expand for more info
App.js
run
preview
console
import React from "react"
import useWordGame from "./hooks/wordGame"

function App() {
const {
timeRemaining,
isTimeRunning,
handleChange,
startClock,
textBoxRef,
wordCount,
text
} = useWordGame(10)

return (
<div>
<br />
<h1>How fast do you type?</h1>
<textarea
ref={textBoxRef}
value={text}
onChange={handleChange}
disabled={!isTimeRunning}
/>
<h4>Time remaining: {timeRemaining}</h4>
<button onClick={startClock} disabled={isTimeRunning}>
{wordCount > 0 ? "Play again" : "Start"}
</button>

{wordCount > 0 && <h1>Word count: {wordCount}</h1>}

</div>
)
}

export default App
Console
/index.html
-2:04