How to add a class with React.js?

前端 未结 5 1813
广开言路
广开言路 2020-12-23 13:32

I need add class \"active\" after click to button and remove all other \"active\" classes.

Look here please: https://codepen.io/azat-io/pen/RWjyZX

va         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-23 13:40

    you can also use pure js to accomplish this like the old ways with jquery

    try this if you want a simple way

     document.getElementById("myID").classList.add("show-example");
    

提交回复
热议问题