How to create a checkbox using React

Here is the code to create a checkbox in React:

jsx
import React, { useState } from 'react';

const Checkbox = () => {
    
    const [checked, setChecked] = useState(false);
   
    return(
        <div className = 'Checkbox'>
            <form>
                <label>
                    <input type = 'Checkbox' checked = {checked} onChange = {(e) => setChecked(!checked)}></input>
                    <span>Click to check/uncheck</span>
                </label>
            </form>
        </div>
    );
    
}

export default Checkbox;

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.