react-router-with-sweg
v2.8.1
Published
A complete routing library for React. Now with SWEG!
Downloads
2
Maintainers
Readme
React Router [![npm package][npm-badge]][npm]
This is a fork of React Router:2.8.1 with SWEG React.
npm install --save [email protected]
## What is SWEG?
In short, SWEG adds an extra argument to your route tranistion hooks, e.g.
##### `onEnter(nextState, theSweg, replace, callback?)`
Instead of: `onEnter(nextState, replace, callback?)`
##### `onChange(prevState, nextState, theSweg, replace, callback?)`
Instead of: `onChange(prevState, nextState, replace, callback?)`
##### `onLeave(prevState, theSweg)`
Instead of: `onLeave(prevState)`
wher theSweg can be created by providing eiter:
1. `const getSweg() => ({ foo: bar, });` prop to `<Router>` component
2. by adding an extra argument (third) to match call, e.g: `match(opts, callback, getSweg = () => ({ foo: bar, }))`
# Looking for the real repo?
https://github.com/reactjs/react-router-tutorial
[npm-badge]: https://img.shields.io/npm/v/react-router-with-sweg.svg?style=flat-square
[npm]: https://www.npmjs.org/package/react-router-with-sweg