react-router-scroll-top

An easy scroll to top component based on the React Router Scroll Restoration Example

Usage no npm install needed!

<script type="module">
  import reactRouterScrollTop from 'https://cdn.skypack.dev/react-router-scroll-top';
</script>

README

react-router-scroll-top

npm Version Build Status

An easy and short-hand component based on the React Router Scroll Restoration Example.

Usage

import ScrollToTop from 'react-router-scroll-top'

const App = () => (
  <Router>
    <ScrollToTop>
      <App/>
    </ScrollToTop>
  </Router>
)

// or just render it bare anywhere you want, but just one :)
<ScrollToTop/>

How to install

If you use yarn

yarn add react-router-scroll-top

And if you use npm

npm install react-router-scroll-top --save