react-with-params
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

react-with-params

Build Status npm version License

React HOC for extracting router params.

Install

yarn add react-with-params
npm install --save react-with-params

Usage

import Route from 'react-router/Route'
import {withParams} from 'react-with-params'
 
const ShowName = withParams('name', {match: '/user/:name'})(({name}) =>
  <span>{name}</span>
)
 
<Route exact path='/user/:name' component={ShowName} />
import Route from 'react-router/Route'
import {withParams} from 'react-with-params'
 
const ShowNameAndId = withParams(['name', 'id'], {match: '/user/:name/:id'})(({name, id}) =>
  <span>{id} - {name}</span>
)
 
<Route exact path='/user/:name/:id' component={ShowNameAndId} />

License

react-with-params is dual-licensed under Apache 2.0 and MIT terms.

Readme

Keywords

none

Package Sidebar

Install

npm i react-with-params

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • beanloop
  • drager