I want to use jquery.scrollbar plugin in my react application. I want the jquery.scrollbar for every component which is scrollable. I have already installed it via npm. I am not getting any way to initialize it in my react component. How should I do it?
-
Do you have code you can share here so we can see what you have so far? You will need to create a component and initialize the scrollbar there, likely in componentDidMount.terpinmd– terpinmd2017-07-10 19:51:47 +00:00Commented Jul 10, 2017 at 19:51
-
I can't recommend using jQuery libraries inside of react apps. It's a common source of trouble because they are interfering when updating the DOM. Try to avoid jQuery at all. There should already be solutions for this provided as react components.trixn– trixn2017-07-10 21:40:27 +00:00Commented Jul 10, 2017 at 21:40
Add a comment
|
1 Answer
Always remember to import it in your components and called the function inside your JSX. I believe react js has some nice scrollbar which are more suitable
3 Comments
EdG
When I use this, browser's scrollbar is also coming and I can see both custom as well as default scrollbar. How to deal with this?
Asmaa Almadhoun
good, and you can use react-nice-scroll it is so easy to use, and here is the link npmjs.com/package/react-nice-scrollbar
feng_nyc
@ApurvG I think I got what you meant. If you wanna remove browser scrollbar. You need to do css style changes to the container thats holding this scrolling area. try set style="overflow-y: hidden"