What is the right way to use Jquery in React?

后端 未结 4 1869
无人及你
无人及你 2020-11-29 11:42

I am trying to work on a project which is using a Layout/Template which uses a lot of jQuery.

I have learned to integrate the template with ReactJS Project, however

4条回答
  •  粉色の甜心
    2020-11-29 12:30

    Is this approach correct? Is it the right way?

    No. Don't use jQuery to attach event listeners to DOM elements created and managed by React. Use onClick'. I could not find#sidebarCollapse` in your snippet. It could look something like this.

    And the class for

提交回复
热议问题