2.8.1 • Published 7 years ago

react-router-with-sweg v2.8.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

React Router npm package

This is a fork of React Router:2.8.1 with SWEG React.

npm install --save react-router-with-sweg@2.8.1

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