redux-router-scroll-restoration
v1.0.1
Published
Middleware for restoration scroll position after changing page
Downloads
258
Maintainers
Readme
Scroll restoration
Simple middleware for scroll restoration.
Install
npm i -S redux-router-scroll-restoration
or
yarn add redux-router-scroll-restoration
Usage
import { createStore, applyMiddleware } from 'redux'
import { routerMiddleware } from 'react-router-redux'
import createHistory from 'history/createBrowserHistory'
import scrollRestorationMiddleware from 'redux-router-scroll-restoration'
import rootReducer from './reducer'
const history = createHistory()
const initialState = {}
const store = createStore(
rootReducer,
initialState,
applyMiddleware(
routerMiddleware(history),
scrollRestorationMiddleware
)
)