How can I apply the ::-webkit-scrollbar pseudo elements to a component using inline styling in React?
3 Answers
This worked in my project '&::-webkit-scrollbar': { width: 0, }
3 Comments
rmlockerd
Welcome 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.
Pavel Shepelenko
seems that it doesn't work in pure React
Elena
this worked in css in react project, for inline styling use Franceso's answer.
You can't write pseudo selector inline, you need to add it in css. Refer this link
3 Comments
mstrewe
According to the answer of @Elena this is not correct
Yuniac
"Page not found" When visiting this 'link'
Louys Patrice Bessette
I fixed the link.
React suggests this
<div style={{ '&::WebkitScrollbar': { width: 0, height: 0 } }}></div>
2 Comments
Francesco Orsi
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
Pavel Shepelenko
Could you please add a link to a source
pesudoselectors asinlinestyles..