]
}
];
//对路由组件容器的二次封装
const RouteWithSubRoutes = route => (
<Route
path={route.path}
render={props => (
<route.component {…props} routes={route.routes} />
)}
/>
);
const RouteConfigExample = () => (
- Tacos
- Sandwiches
{routes.map((route, i) => <RouteWithSubRoutes key={i} {…route} />)}
);
export default RouteConfigExample;
[](()路由传参
===================================================================
[](()向路由组件传递params参数
-
路由链接(携带参数):< link to=“/demo/tom/18”></ link >
-
注册路由(接收参数):< Route path=“/demo/:name/:age” component={Test}></ Route >
-
接收参数:const {name ,age} = this.props.match.params
import React from “react”;
import { BrowserRouter as Rou
-