xxxxxxxxxx
const [isSubscribed, setIsSubscribed] = useState(false);
const handleChange = event => {
if (event.target.checked) {
console.log('✅ Checkbox is checked');
} else {
console.log('⛔️ Checkbox is NOT checked');
}
setIsSubscribed(current => !current);
};
return (
<input
type="checkbox"
value={isSubscribed}
onChange={handleChange}
id="subscribe"
name="subscribe"
/>
);