Scroll behaviors for use with history, inspired by scroll-behavior
npm install use-scroll-behaviorScroll behaviors for use with history. Inspired by scroll-behavior and simplify the behavior.
Enhance your history object with this library to get standard scroll behavior after history changed.
``jsx`
import { browserHistory } from 'react-router';
import useScroll from 'use-scroll-behavior';
const history = useScroll(browserHistory);
// ...
export default class App extends Component {
render() {
return (
//..your routes
);
}
}
``
$ npm install history use-scroll-behavior
js
const history = scrollBehavior(browserHistory, {
excludePath: [/news\/id/],
});
``[npm-badge]: https://img.shields.io/npm/v/use-scroll-behavior.svg?style=flat-square
[npm]: https://www.npmjs.com/package/use-scroll-behavior
[build-badge]: https://img.shields.io/travis/blackbing/use-scroll-behavior/master.svg?style=flat-square
[build]: https://travis-ci.org/blackbing/use-scroll-behavior
[coveralls-badge]: https://img.shields.io/coveralls/blackbing/use-scroll-behavior/master.svg?style=flat-square
[coveralls]: https://coveralls.io/github/blackbing/use-scroll-behavior?branch=master