import {useState} from 'react';
export default function App() {
const [isSubscribed, setIsSubscribed] = useState(false);
const handleChange = event => {
setIsSubscribed(event.target.checked);
// 👇️ this is the checkbox itself
console.log(event.target);
// 👇️ this is the checked value of the field
console.log(event.target.checked);
};
return (
<div>
<label htmlFor="subscribe">Subscribe</label>
<input
type="checkbox"
id="subscribe"
name="subscribe"
onChange={handleChange}
checked={isSubscribed}
/>
</div>
);
}