0
新規対応反応ルータで子コンポーネントをレンダリングする際に問題が発生しました。 My Appコンポーネントはうまくレンダリングされます。 Child1またはChild2の親コンポーネントでAppを交換すると、それらも同様に機能します。しかし、反応ルータ内の私の入れ子にされたコンポーネントはレンダリングされていないようです。私は何が欠けていますか?リアクションルータが子コンポーネントを表示しない
var App = React.createClass({
render: function() {
return <h1 className="red">
dfdf
{this.props.children}
</h1>
}
});
var Child1 = React.createClass({
render: function() {
return (
<h1>I am a Child</h1>
)
}
});
var Child2 = React.createClass({
render: function() {
return (
<h1>I am the other Child</h1>
)
}
});
var routes = (
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path="1" component={Child1} />
<Route path="2" component={Child2} />
</Route>
</Router>
)
ReactDOM.render(routes, document.querySelector('.container'));
更新わかりましたので、私はこれがhashHistoryで動作するように得ることができますが、browserHistoryは動作しません。どうしてこれなの?
expressを使用しますか? –
通常です。現在私はちょうど学んでいると私はgulpのライブリロードサーバーを実行しているが、ノードまたはエクスプレスを使用していない。私のURLはhttp:// localhost:8000 /#/ 2のように見えますか?_k = 9pug17 browserHistoryは、このページをexpressなどのサービスで提供する必要がありますか? – ceckenrode
http://stackoverflow.com/questions/35063095/react-router-browserhistory-not-working-as-expected –