1.0.1 • Published 6 years ago

redux-router-scroll-restoration v1.0.1

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

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
  )
)