Next.js Discord

Discord Forum

Regarding custom react checkbox

Unanswered
Dwarf Crocodile posted this in #help-forum
Open in Discord
Dwarf CrocodileOP
So, I made a custom checkbox.
In this, user can select multiple options. By default, 'Ensemble' is checked.

The code for this: https://codeshare.io/k0NgAV
There is more code, but I am just sharing the code specific to this component.

The problem is: I can't select or deselect any options here.

12 Replies

Dwarf CrocodileOP
where?
@Dwarf Crocodile where?
The input element in your code
The code is working fine now. i dont know why, the same code is not working on my local websites code
some people said, that i defined a component inside a component, that was causing an issue locally.

When I defiend it outside, it worked fine on my local website.
Hmm... I got confused there for a second. I forgot isChecked is what needs to be boolean in a checkbox.
Dwarf CrocodileOP
isChecked={jobTypes.includes('ensemble_net_jd')}

IsChecked will be true if its included in jobTypes.
so yes, its already a boolean values here