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?
Asked
Active
Viewed 1,787 times
0
-
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 Jul 10 '17 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 Jul 10 '17 at 21:40
1 Answers
2
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

Yuhao
- 147
- 9
-
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? – EdG Jul 10 '17 at 20:43
-
good, and you can use react-nice-scroll it is so easy to use, and here is the link https://www.npmjs.com/package/react-nice-scrollbar – Asmaa Almadhoun Jul 10 '17 at 21:16
-
@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" – Yuhao Jul 10 '17 at 21:25