Reactjs 如何将通量传递到反应路由器1.0.0
这显示了如何为旧版本的React router执行此操作 有人知道如何将通量作为道具传递到react router 1.0.0中的顶级组件吗 我在文档中看到,在react router 1.0.0中,路由可以被描述为对象,这意味着你可以传递任意的道具。但是,这对我不起作用:Reactjs 如何将通量传递到反应路由器1.0.0,reactjs,flux,react-router,Reactjs,Flux,React Router,这显示了如何为旧版本的React router执行此操作 有人知道如何将通量作为道具传递到react router 1.0.0中的顶级组件吗 我在文档中看到,在react router 1.0.0中,路由可以被描述为对象,这意味着你可以传递任意的道具。但是,这对我不起作用: routes = path: "/" flux: flux component: App childRoutes: [ {path: "/path/to/pa
routes =
path: "/"
flux: flux
component: App
childRoutes: [
{path: "/path/to/path", component: Comp, flux: flux}
]
React.render(<Router routes={routes} />, document.getElementById("app"))
路由=
路径:“/”
通量:通量
组件:应用程序
儿童路线:[
{path:“/path/to/path”,组件:Comp,通量:flux}
]
React.render(,document.getElementById(“app”))
应用程序上没有作为道具的通量迹象
语法是Coffee脚本,但基本上routes是一个对象,如下所述:
您可以将函数传递给路由器createElement
属性,该属性将通量属性传递给子组件
const createFluxComponent = (Component, props) => {
return <Component {...props} flux={flux} />;
};
React.render(
<Router createElement={createFluxComponent}>
...
const createFluxComponent=(组件、道具)=>{
回来
};
反应(
...