I have a simple react component that has a check box i want to toggle the value for on a click, it seems like it completely ignores my click I cant even get a console log. No idea why this doesnt work
export const InputCheckbox: InputCheckboxComponent = ({ id, checked = false, disabled, onChange }) => {
const { current: inputId } = useRef(`RampInputCheckbox-${id}`)
const handleClick = () => console.log('click');
return (
<div className="RampInputCheckbox--container" data-testid={inputId}>
<label
className={classNames("RampInputCheckbox--label", {
"RampInputCheckbox--label-checked": checked,
"RampInputCheckbox--label-disabled": disabled,
})}
/>
<input
id={inputId}
type="checkbox"
className="RampInputCheckbox--input"
onChange={handleClick}
/>
</div>
)
}
I've tried changing to onClick and I noticed the component isn't re-rendering on the click
Aucun commentaire:
Enregistrer un commentaire