2 years ago

#362710

test-img

coolest-duck

Inline styling in React functional component for #root element

I have created a React functional component where I have attached an event listener for scrolling. I have observed that this event listener needs to be attached to the element with ID = "root" i.e something of this sort - document.getElementById("root"). Currently, I have a seperate CSS file to apply the styling to my component specifically for the scrollbar. The CSS stylesheet has a single class #root where I provide overflow-y: scroll, so that scrolling happens properly. But now, I wish to get this styling within my React functional component. How can this be done ?

css

reactjs

scrollbar

react-functional-component

0 Answers

Your Answer

Accepted video resources