Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xiaofan2406/react-router-v4-hocs
Set of higher order components for react router v4
https://github.com/xiaofan2406/react-router-v4-hocs
Last synced: about 1 month ago
JSON representation
Set of higher order components for react router v4
- Host: GitHub
- URL: https://github.com/xiaofan2406/react-router-v4-hocs
- Owner: xiaofan2406
- Created: 2016-11-03T23:25:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-28T01:50:06.000Z (about 3 years ago)
- Last Synced: 2024-04-12T07:02:40.027Z (10 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-router-v4-hocs
> Set of higher order components for `React Router v4`### @deprecated
latest version of `react-router-dom` includes `withRouter`### [React Router v4 docs](https://react-router.now.sh/)
### Usage
```js
import withRouter from 'react-router-v4-hocs/lib/withRouter';
// import { withRouter } from 'react-router-v4-hocs';class MyComponent extends React.Component {
...
}export default withRouter(MyComponent);
```### API
##### withLocation
- Give wrapped component `location` prop.
- Default `location` shape:```js
{
hash: String
pathname: String
query: Object | null
search: String
state: Object | null
}
```##### withRouter
- Give wrapped component `router` prop.
- Default `router` shape:```js
{
blockTransitions: Function
createHref: Function
replaceWith: Function
transitionTo: Function
}
```