Amirhosein Shirani
Amirhosein Shirani

Reputation: 393

Can React and jQuery be used together?

I am working on a react project. Our designer uses jQuery and Bootstrap for our web-app . Can I use both React and jQuery together? Are these compatible together?

Upvotes: 0

Views: 511

Answers (1)

Adnan Y
Adnan Y

Reputation: 3240

Not for the same section of the page.

In general, react is a bit clingy and likes to keep the full ownership for the dom node. However, it doesn't has to be the root node, just A node.

Take this for example:

<html>
  <head>
    <!--- scripts, fonts and css--->
  </head>
  <body>
    <div id="react-root"></div>
    <div id="jquery-node"></div>
  </body>
</html>

In this, as long as your jquery doesn't try to modify the #react-root node, everything is peachy.

Note that you can pretty much do anything throughout the page, just do not modify or even assume anything about the #react-node or anything inside it.

Upvotes: 1

Related Questions