Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React radio input issue

Tags:

reactjs

I am trying to render the following JSX code. When I add the 'Yes' and 'No' text to complement the radio buttons, I get the following error...

 <tr>
    <td>Do you want the questions displayed in a random order?</td>
    <td><input type="radio" name="random">Yes</input></td>
    <td><input type="radio" name="random">No</input></td>
 </tr>

Error: input is a void element tag and must neither have children nor use dangerouslySetInnerHTML.

What am I doing wrong?

like image 959
nikotromus Avatar asked Sep 04 '26 06:09

nikotromus


1 Answers

Use label

<label for="yes">Yes</label>
<input type="radio" id="yes" name="random"/>
like image 60
Rami Enbashi Avatar answered Sep 07 '26 03:09

Rami Enbashi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!