How to scroll down page using React button component?

Viewed 45

I want to press a button and the page scrolls down automatically to the next piece of content. I know in HTML I'd use sections but for React I am still learning on how to create this function.

import Button from '@material-ui/core/Button';

function scrollDownPage(){
 window.scrollTo(PageContent) <<<< I SCROLL THE PAGE DOWN TO PAGE CONTENT COMPONENT
}

function App() {
const style = useStyles();

return(

<Button
onClick={scrollDownPage} // <<<<<<<<<THIS 
>
</Button>

<PageContent/>

)}
0 Answers
Related