1.0.0 • Published 7 years ago

serlina-react-router v1.0.0

Weekly downloads
18
License
-
Repository
-
Last release
7 years ago

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

1.0.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago