USESTATE Hook для проверки флажок и снижения.
const { useState } = React; // --> for inline use
// import React, { useState } from 'react'; // --> for real project
const App = () => {
const [checked, setChecked] = useState(false)
const handleClick = () => setChecked(!checked)
return <input onClick={handleClick} checked={checked} type="checkbox" />
};
ReactDOM.render(<App />, document.getElementById('root'))
Fantastic Fish