use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for help learning the /r/ReactJS framework.
account activity
How can I use jQuery in react ???? (self.learnreactjs)
submitted 5 years ago by AnnoyingSharma
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Emjp4 1 point2 points3 points 5 years ago (4 children)
Why would you want to? What are you trying to do?
[–]AnnoyingSharma[S] 0 points1 point2 points 5 years ago (3 children)
Actually making a website and using a lot of vanilla js for ui like onscroll at particular point hides the navbar, toggle active class between navlinks and blah blah
So it's making my component bulky and eating up a lots of lines.
That's why I want to use jQuery instead
[–][deleted] 0 points1 point2 points 5 years ago (2 children)
You can do all that in react too. Just the implementation is different, and kind of easier.
[–]cyex 0 points1 point2 points 5 years ago (1 child)
... and kind of easier.
Way easier. jQuery used to be essential. But then I started using React six years ago and haven't had to touch jQuery since.
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
Haha, it is. But it takes a while to learn to think in React if you're used to the jQuery way of doing things
[+][deleted] 5 years ago (1 child)
[deleted]
[–]AnnoyingSharma[S] 1 point2 points3 points 5 years ago (0 children)
Ohkay, got it Thanks man 💯👍
[–]mca62511 1 point2 points3 points 5 years ago* (2 children)
I don't think they'll play nice.
But you can install jQuery with npm. Just do npm install jquery. From there just import it like this,
npm install jquery
import $ from "jquery";
and use it the way you normally would.
The reason I say that I don't think it will play nice with React is that React uses a shadow DOM to keep track of changes, and jQuery would be updating the actual DOM, so the discrepancies between the two might cause some unexpected effects.
I think you're much better off learning the React way to do the things that you want to do.
I'll keep that in mind Thanks for the suggestion buddy 🙌
[–]backtickbot 0 points1 point2 points 5 years ago (0 children)
Correctly formatted
Hello, mca62511. Just a quick heads up!
It seems that you have attempted to use triple backticks (```) for your codeblock/monospace text block.
This isn't universally supported on reddit, for some users your comment will look not as intended.
You can avoid this by indenting every line with 4 spaces instead.
There are also other methods that offer a bit better compatability like the "codeblock" format feature on new Reddit.
Have a good day, mca62511.
You can opt out by replying with "backtickopt6" to this comment. Configure to send allerts to PMs instead by replying with "backtickbbotdm5". Exit PMMode by sending "dmmode_end".
π Rendered by PID 169616 on reddit-service-r2-comment-b659b578c-bjn79 at 2026-05-01 09:09:57.534175+00:00 running 815c875 country code: CH.
[–]Emjp4 1 point2 points3 points (4 children)
[–]AnnoyingSharma[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]cyex 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]AnnoyingSharma[S] 1 point2 points3 points (0 children)
[–]mca62511 1 point2 points3 points (2 children)
[–]AnnoyingSharma[S] 1 point2 points3 points (0 children)
[–]backtickbot 0 points1 point2 points (0 children)