if you click any of 3 radio button in any time it will count the number of clicked if the number of clicked is greater than 3 in console it give message you win or else you lose ,but its not working
import React, { useState } from 'react';
export default function App() {
const [disable, setDisable] = useState(false);
const check = ({target}) => {
if (target.id==='one') {
setDisable(true);
}
else {
setDisable(false);
}
}
const handlechange=(e)=>{
let c=e.target.value;
if(c.length>3)
console.log('win')
else
console.log('lose')
}
return (
<>
<input type="radio" onChange={(e) => {check(e);handlechange(e)}} disabled={disable} name="one" />
<input type="radio" onChange={(e) => {check(e);handlechange(e)}} disabled={disable} name="one" />
<input type="radio" onChange={(e) => {check(e);handlechange(e)}} disabled={disable} name="one" id="one"/>
</>
);
}