Created
November 29, 2021 11:38
-
-
Save codewithbernard/748b1d40a860caee699dd2e86700ee30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| const App = () => { | |
| return ( | |
| <div className="container"> | |
| <button | |
| onClick={() => | |
| window.scrollTo({ | |
| left: 0, | |
| top: window.innerHeight, | |
| behavior: "smooth", | |
| }) | |
| } | |
| > | |
| Scroll to bottom | |
| </button> | |
| <button | |
| onClick={() => | |
| window.scrollTo({ | |
| left: 0, | |
| top: 0, | |
| behavior: "smooth", | |
| }) | |
| } | |
| > | |
| Scroll top top | |
| </button> | |
| </div> | |
| ); | |
| }; | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment