mercredi 18 août 2021

Unhandled Rejection (Error) when inserting a checkbox on React App

I am trying to display text, then a checkmark immediately right after it. However, I get the error "Unhandled Rejection (Error): input is a void element tag and must neither have children nor use dangerouslySetInnerHTML."

I understand it shouldn't have children, so I have also tried moving it to before the </li> end tag. I also tried the idea of doing something like: <input / >, as I have tried searching for the answer online.

I'm stumped! Any help would be appreciated. Thank you!

return (
 <div>
    <div>
        <table className = "className">
          <tbody>
          <tr>
            <th>Only avaliable Now</th>
          </tr>
              {this.state.time_array.map(item => (
                <tr>
                  <td>
                    <li><b> {item.id}</b> 
                        <input type="checkbox" 
                          id={item.Name}>
                          checked={item.gotIt}
                        </input>
                        <ul>
                           <li>Where to find: {item.find}</li>                      
                        </ul>
                    </li>
                </td>
              </tr>
              ))}
            </tbody>
        </table>
    </div>
  </div>      
);



Aucun commentaire:

Enregistrer un commentaire