Pass component name in onChange [closed]

Rather than passing handleChange directly to onChange, you can use an anonymous function to call it:

<CheckboxControl
    key={index}
    checked={isChecked}
    label={element.title}
    help={element.description}
    name={element.name}
    onChange={(value) => { 
        handleChange(element.name, value);
    }}
/>

Then your handleChange function can accept the name and value as its parameters.

const handleChange = (name, value) => {
    setInputs(values => ({...values, [name]: value}));
};

error code: 523