I'm using a NextUi Checkbox component and I'm trying to create a handleFonction in order to get boolean of the event (true of false). So I use event.target.checked but it returns undefined. Event if I use event.checked it dosen't work (still undefined)
here my function to handle checkbox :
`const handleChange = (event, option) => { const checked = event.target.value
if (checked) {
changePrice(option.price)
} else {
changePrice(-option.price)
}
}`
and here my component form Nextui
<Checkbox
color='warning'
id={option.text}
name={option.text}
size='md'
className={styles.checkbox}
label={option.text}
isRounded={true}
onChange={(event) => handleChange(event, option)}
/>
Thanks a lot for your reply
Aucun commentaire:
Enregistrer un commentaire