mirror of
https://github.com/genemecija/learn-morse-code.git
synced 2026-02-10 17:34:15 +01:00
16 lines
423 B
JavaScript
16 lines
423 B
JavaScript
|
|
import React, {useContext} from "react"
|
||
|
|
import { WPMContext } from "../contexts/wpmContext";
|
||
|
|
|
||
|
|
export default React.memo(function WordsPerMinute(props) {
|
||
|
|
console.log('WordsPerMinute rendered');
|
||
|
|
|
||
|
|
const {wpm, setWPM} = useContext(WPMContext)
|
||
|
|
|
||
|
|
function handleChange(e) {
|
||
|
|
setWPM(e.target.value)
|
||
|
|
}
|
||
|
|
|
||
|
|
return (
|
||
|
|
<input id='wpm-input' type='text' value={wpm} onChange={handleChange} />
|
||
|
|
)
|
||
|
|
})
|