I am using reactjs and bootstrap v 3.0 but I can't find any collapse class in there so I defined this in my scss. The problem is that the togglebutton does not work or the toggleevent is not triggered on the div:
toggle(e) {
console.log('testing e',e)
if (e.target.class === 'collapse') {
e.target.className = 'collapse.in'
} else {
e.target.className = 'collapse'
}
}
This is my button:
<button className="btn btn-block" onClick={() => {
this.toggle.bind('demo')
}}>
Open/close
</button>
How can I change the className from collapse to collapse.in and viceversa? Here is a code sample:Codepen
e.target.className = 'collapse in'