serlina-react-router

1.0.0 • Public • Published

serlina-react-router

npm downloads

Usage

npm i react-router-dom serlina-react-router --save
class Home extends React.Component {

  render () {
    return (
      <div>
        <div>Home</div>
        <Switch>
          <Route path='/' exact component={Index} />
          <Route path="/about" exact component={About} />
          <Route path="/posts" exact component={Posts} />
        </Switch>
      </div>
    )
  }
}

export default withRouter(Home, {
  getUrl({ ctx }) {
    return ctx.url
  }
})

options

  • getUrl: (payload) => string should return current url
  • basename The base URL for all location.

Use with serlina-apollo

export default withApollo(withRouter(Home, {
  getUrl({ ctx }) {
    return ctx.url
  }
}), client)

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i serlina-react-router

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

8.76 kB

Total Files

7

Last publish

Collaborators

  • djyde