国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

How to select multiple checkboxes in Reactjs
P粉950128819
P粉950128819 2024-04-06 18:55:21
0
1
831

I have an option list in which I want to select multiple checkboxes but am unable to do so, what is wrong with this code?

Sandbox URL

P粉950128819
P粉950128819

reply all(1)
P粉545218185

According to your requirements, you can change handleCheckboxQuestionInput to:

const handleCheckboxQuestionInput = (e) => {
    const answer = e.target.value;
    setSelectedAnswers((prevAnswers) => {
      if(prevAnswers.includes(answer)) {
        return prevAnswers.filter(e => e !== answer)
      } else {
        return [...prevAnswers, answer]
      }
    });
  };

and change at the input element to:

 handleCheckboxQuestionInput(e)}
 />

Hope it helps you

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template