new2cpp
new2cpp

Reputation: 3677

bootstrap checkbox button did not triggered in react

I want to re-write https://v4-alpha.getbootstrap.com/components/buttons/#checkbox-and-radio-buttons in react. Kindly review https://codepen.io/gamesover/pen/MoExWo?editors=1111 . There are two issues

  1. Clicking checkbox1, handleChange is not triggered
  2. Given checkbox1 initial status is on, click the checkbox1, its status becomes off. However, the background color is still dark, you have to click somewhere else to make the button background color become light(off status)

Upvotes: 0

Views: 193

Answers (2)

Upasana
Upasana

Reputation: 1975

Answer is in reference to your codepen example.

The background color is depending on the 'active' class. In case of changing the checked status the active class is not getting change I guess. I have created a simple github repository with react setup. And is working as expected. Please check this once and let me know if this solves your issue.

Attaching a screenshot of console message that you wanted to print.

enter image description here Hope it helps.

Upvotes: 1

Upasana
Upasana

Reputation: 1975

I have tried your example locally with a react setup and the console prints the message of handleChange.However, in codepen its not getting printed probably a codepen issue. Have you tried this on a local react setup? If not please do check once probably a codepen issue.

Upvotes: 0

Related Questions