mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
31 lines
687 B
TypeScript
31 lines
687 B
TypeScript
import * as React from 'react'
|
|
import {
|
|
BrowserRouter as Router,
|
|
RouteComponentProps,
|
|
Route,
|
|
Link
|
|
} from 'react-router-dom'
|
|
|
|
const ParamsExample = () => (
|
|
<Router>
|
|
<div>
|
|
<h2>Accounts</h2>
|
|
<ul>
|
|
<li><Link to="/netflix">Netflix</Link></li>
|
|
<li><Link to="/zillow-group">Zillow Group</Link></li>
|
|
<li><Link to="/yahoo">Yahoo</Link></li>
|
|
<li><Link to="/modus-create">Modus Create</Link></li>
|
|
</ul>
|
|
|
|
<Route path="/:id" component={Child}/>
|
|
</div>
|
|
</Router>
|
|
)
|
|
|
|
const Child: React.SFC<RouteComponentProps<{id: string}>> = ({ match }) => (
|
|
<div>
|
|
<h3>ID: {match.params.id}</h3>
|
|
</div>
|
|
)
|
|
|
|
export default ParamsExample |