Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Radio button in react

  const [gender,setgender]=useState()

 const handlegender=(e)=>{
    setgender(e.target.value)
  }
 

 
 <form>
        
        <div>
          <label>Gender</label>
          <input type="radio" name="gender" value="male" onChange={handlegender} />
          Male
          <input type="radio" name="gender" value="Female" onChange={handlegender}/>
          Female
        </div>
      </form>
 
PREVIOUS NEXT
Tagged: #Radio #button #react
ADD COMMENT
Topic
Name
8+1 =