1 import React from 'react'; 2 import ReactDOM from 'react-dom'; 3 import { Router, Route, hashHistory,browserHistory,IndexRoute,Link } from 'react-router'; 4 5 6 class App extends React.Component { 7 render () { 8 return ( 910 app:{ this.props.children}1119 );20 }21 }22 class Report extends React.Component {23 render () {24 return (2512
17 18- about
13- report
14- /report/15
15 16Report26 );27 }28 }29 class About extends React.Component {30 render () {31 return (3233 About { this.props.location.query.id} params:{ this.props.params.id}34 { /*about?id=3 得到地址栏参数 后一个得到这样: http://localhost:8888/build/test/router.htm#/about/15*/}3536 );37 }38 }39 40 41 42 43 let rs=4445 ;52 53 ReactDOM.render(rs, document.getElementById('container'));46 47 48 49 50 51