を超え反応は最大コールスタックのサイズは、私は彼がログインしていない場合は、「TrapPage」にユーザーをリダイレクトしようとしている
ここに私のコードです:。
私が関数requireAuthを入れfunction requireAuth(nextState, replace) {
if (!auth.loggedIn()) {
replace({
pathname:'/trap'
})
}
}
export default (
<Route path="/" component={App} onEnter={requireAuth}>
<IndexRoute component={DashboardPage} />
<Route path="trap">
<IndexRoute component={TrapPage}/>
</Route>
<Route path="accounts">
<IndexRoute component={AccountPage}/>
<Route path="add" component={AccountAdd} />
<Route path="detail/:id" component={AccountDetail} />
</Route>
<Route path="contacts">
<Route path="detail/:id" component={ContactPage}/>
</Route>
<Route path="transmissors">
<Route path="detail/:id" component={TransmissorPage}/>
</Route>
<Route path="attends" component={AttendancePage} />
<Route path="reports" component={ReportPage} />
<Route path="configs" component={ConfigurationPage} />
</Route>
);
フォーカス取得時、コンソールは私にエラーを与える:
Uncaught RangeError: Maximum call stack size exceeded
私が反応でbegginer思い、我慢してください:)
私のコードで何が間違っていますか?
<経路パス= "トラップ">の変更に関するアドバイスはありますか? –
@AlessanderFrança私はもう少しガイダンスを与えるために私の答えを更新しました。 –
オクラホマ、私はここで試しています:) –