4
私はreact-router
でプロジェクトを開発しています。反応ルータはコンポーネントをレンダリングしません
以下は私のコードです。
const App2 = React.createClass({
render() {
return (
<div>
<Link to="index">index</Link>
<Link to="favorite">favorite</Link>
<Link to="myPage">myPage</Link>
{this.props.children}
</div>
)
}
});
var app = ReactDOM.render (
<Router history={browserHistory}>
<Route path="/" component={App2}>
<Route path="index" component={PhotoFeedWrapper}/>
<Route path="favorite" component={FavoriteWrapper}/>
<Route path="myPage" component={MyPageWrapper}/>
</Route>
</Router>,
document.getElementById('app')
);
私のコードは正しいと思います。しかし、これは以下のように空になります。
<div id="app"><!-- react-empty: 1 --></div>
スクリプトエラーはありません。
どうしたのですか?
どのようにアクセスしていますか? 'http:// localhost/index'を使用していますか?また、他のコンポーネントを投稿して、それらが正しいかどうか確認できますか? –
@WilliamMartinsいいえ、http:// localhost:8080/contextPath/index'にアクセスしています。私はノード上で使用しません。私は春とUMDビルドで使用します。そう、私はそのように使います。他のコンポーネントは正しい –
これは奇妙です、あなたのリンクはレンダリングされていますか? –