Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
facing issue to select radio button in React JS

I am working on form which have combination of input field and radio button. Whenever I select the radio button, it is not getting selected but value is getting update in form state . For some reason, radio button is not showing selected

const InputForm = () => {
    const [form, setForm] = useState({name: "", job: "no" });
    const {name, job} = form;
    
 const handleJob = (e) => {
    let value = e.target.value;
    setForm({ ...form, job: value });
  };

const onInputChange = (e) => {
setForm({...form, [e.target.name]: e.target.value});
}


return (
<>
                 <input
                  type="text"
                  className="form-control input-text-box"
                  placeholder="Name"
                  value={name}
                  onChange={onInputChange}
                />
<div className="form-check-inline mx-2">
                  <input
                    type="radio"
                    className="form-check-input"
                    name="radioOption"
                    value="yes"
                    onChange={handleJob}
                    checked={job === "yes"}
                    
                  />{" "}
                  <label className="form-check-label" for="radioOption">
                    Yes&nbsp;
                  </label>
                  <input
                    type="radio"
                    name="radioOption"
                    className="form-check-input"
                    value="no"
                    onChange={handleJob}
                    checked={job === "no"}
                     
                  />{" "}
                  <label className="form-check-label" for="radioOption">
                    No
                  </label>
                </div>
</>
);
};

export default InputForm;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!