How can I apply the ::-webkit-scrollbar
pseudo elements to a component using inline styling in React?
Asked
Active
Viewed 2.5k times
3 Answers
14
You can't write pseudo
selector inline, you need to add it in css. Refer this link

Martin54
- 1,349
- 2
- 13
- 34

satyajit rout
- 1,623
- 10
- 20
14
This worked in my project '&::-webkit-scrollbar': { width: 0, }

Elena
- 141
- 1
- 3
-
3Welcome to SO. Please take time to explain your answers rather than just post code. When answering an older question with other, accepted answers, also explain how your answer is different or an improvement/update on the others. – rmlockerd Aug 06 '21 at 22:13
-
1
React suggests this
<div style={{ '&::WebkitScrollbar': { width: 0, height: 0 } }}></div>

Francesco Orsi
- 1,739
- 4
- 16
- 32
-
not sure why I received a negative vote, that is what React suggests on console when I try to add "webkit-scrollbar", and it works – Francesco Orsi Sep 19 '22 at 15:32
-