0.0.5 • Published 7 years ago
react-router-v4-hocs v0.0.5
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
Usage
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:{ hash: String pathname: String query: Object | null search: String state: Object | null }
withRouter
- Give wrapped component
router
prop. Default
router
shape:{ blockTransitions: Function createHref: Function replaceWith: Function transitionTo: Function }