加入代碼中有這樣一個路由需要渲染;render( <Router history = {browserHistory} >
<route path ="/" component={App} >
<IndexRoute component={Home} />
<route path ="/jianjie" component={jianjie} />
<route path ="/yewu" component={yewu} />
<route path ="/lianxi" component={lianxi} />
<route path ="/about" component={About} />
<route path ="/test" component={test} />
</route></Router>, ele)但是App組件是這樣的;import React ,{ Component }from 'react';import Nav from './nav';import Foot from './foot';class App extends Component{
constructor(props){ super(props);
}
render(){ return ( <div>
{this.props.name} <Nav />
{this.props.children} <Foot />
</div>
)
}
}export default App;App組件中這個 {this.props.name}是通過外面參數傳遞進來的,但是上面的代碼中怎么向App傳遞參數呢;如果是單純的渲染App可以這樣寫:render( <App {...props}/>, ele)希望有知道的朋友幫忙解答一下啊
react路由中如何向組件傳參數呢
互換的青春
2018-10-09 13:42:04