Regarding custom react checkbox
Unanswered
Dwarf Crocodile posted this in #help-forum
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.
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
If so you need to use state
In the value prop
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.
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 Crocodile 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.
Ohh maybe that could be it. I'm on mobile so i cant really check it out
Dwarf CrocodileOP
isChecked={jobTypes.includes('ensemble_net_jd')}
IsChecked will be true if its included in jobTypes.
IsChecked will be true if its included in jobTypes.
so yes, its already a boolean values here