0
同じコンポーネントを使用するようにしていますが、ルートに応じて別のコンポーネントを渡そうとしています。React RouterのReactコンポーネントのインスタンスをインポートで作成する
import React from "react";
import ReactDOM from "react-dom";
import { Router, Route, IndexRoute, hashHistory } from "react-router";
import Layout from "./pages/Layout";
import ApplicantsContainer from "./pages/ApplicantsContainer";
import Filtered from "./pages/Filtered";
import ApplicantStore from "./stores/ApplicantStore";
const app = document.getElementById('app');
ReactDOM.render(
<Router history={hashHistory}>
<Route path="/" component={Layout}>
<IndexRoute/>
<Route path="new" component={ApplicantsContainer} getData={ApplicantStore.getNew.bind(ApplicantStore)}/>
<Route path="prescreen" component={ApplicantsContainer} getData={ApplicantStore.getPrescreen.bind(ApplicantStore)}/>
<Route path="interview" component={ApplicantsContainer} getData={ApplicantStore.getInterview.bind(ApplicantStore)}/>
<Route path="offer" component={ApplicantsContainer} getData={ApplicantStore.getOffer.bind(ApplicantStore)}/>
<Route path="hired" component={ApplicantsContainer} getData={ApplicantStore.getHired.bind(ApplicantStore)}/>
<Route path="declined" component={ApplicantsContainer} getData={ApplicantStore.getDeclined.bind(ApplicantStore)}/>
<Route path="filtered" component={Filtered}/>
</Route>
</Router>,
app);
問題は、すべてのルートがコンポーネントの同じインスタンスを受け取り、最初のgetDataプロップのみを使用することです。 ApplicantsContainerコンポーネントの別のインスタンスを宣言するにはどうすればいいですか?
反応し、ルータのAPIでのための "のgetData" プロパティを見つけることができませんhttps://github.com/ReactTraining/react-router/blob/master/に書き換えることができます。 docs/API.md。どこで手に入れましたか?また、コンポーネントでどのように使用できますか? –