How to create a checkbox using React

Here is the code to create a checkbox in React:

import React, { useState } from 'react';

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

export default Checkbox;

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