function scrolup react code example
Example 1: how to scroll to an element javascript react
import { scroller } from "react-scroll";
// excluded React component syntax...
scrollToSection = () => {
scroller.scrollTo("your_css_class_here", {
duration: 800,
delay: 0,
smooth: "easeInOutQuart",
});
};
Example 2: how to make page scroll to the top jsx
componentDidMount() {
window.scrollTo(0, 0)
}