Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
Merge tag '0.0.3' into dev
Browse files Browse the repository at this point in the history
0.0.3
change code in readme
  • Loading branch information
ipatate committed Aug 18, 2017
2 parents ad7f21f + d9fe1c7 commit 51e641f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions README.md
@@ -1,22 +1,33 @@
### Simple react component to keep the scroll of the page and to restore it if the user clicks on the back button of its browser

I did this package because I was frustrated that the new react router (4) does not restore the scroll when I click on the back button of my browser.
I did this package because I was frustrated that the new react router (4) does not restore the scroll when I click on the back button of my browser. By default, the component execute window.scrollTo(0,0), if the url not exist in memory. It only stores the last 2 url.

only work with react and react router v4

#### import component in your main page
#### import component in your main page.

```javascript
import ScrollMemory from 'react-router-scroll-memory';
```

#### add the component after the Router
#### add the component after the Router.

```jsx
<BrowserRouter>
<ScrollMemory />
<App />
<div>
<ScrollMemory />
<App />
</div>
</BrowserRouter>
```

#### Tested on Browser:

* Chrome
* Explorer 11
* Edge
* Safari
* Firefox



4 changes: 2 additions & 2 deletions package.json
@@ -1,13 +1,13 @@
{
"name": "react-router-scroll-memory",
"version": "0.0.2",
"version": "0.0.3",
"description": "Simple react component to keep the scroll of the page and to restore it if the user clicks on the back button of its browser",
"main": "./dist/bundle.js",
"scripts": {
"test": "jest",
"flow": "node_modules/.bin/flow",
"build": "rollup -c",
"prepublish": "npm run build"
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 51e641f

Please sign in to comment.