リアクションルータを使用していますので、クリックしたときに詳細ページにリダイレクトしたいと思います。ここでリアクションルータのプッシュではURLのみが変更されます
は私のコンポーネント変更しましたが、私のページは同じまま、URLをクリックしてオン
<Table
model={TypeModel}
source={this.props.types}
selectable={false}
onRowClick={index => this.context.router.push(`/dashboard/types/${this.props.types[index].id}`)}
/>
です。私はこのようなルートを定義しました
{
path: '/dashboard',
component: requireAuthentication(DashboardLayout),
indexRoute: Dashboard,
childRoutes: [{
path: 'types',
indexRoute: TypeListRoute(store),
childRoutes: [
TypeDetailsRoute(store) // The path of this route is :id
]
}]
}
私は理由がわかりません、これはアプリケーション内の他の場所で動作しています。私もチェックして、これは
私が何かを見逃していました
- browserhistory-push-doesnt-navigate-to-new-pageをスレッド試してみましたか?
詳細
私のルータ
にそのラップの子供たちの反応構成要素であるDashboardLayout
は、いくつかのコンポーネントcreateRoutes = store => ({ childRoutes: [{ path: '/', component: HomeLayout, indexRoute: Home, childRoutes: [ LoginRoute(store), LogoutRoute(store), SignupRoute(store) ] }, { path: '/dashboard', component: requireAuthentication(DashboardLayout), indexRoute: Dashboard, childRoutes: [ DeviceRoute(store), UserRoute(store), { path: 'types', indexRoute: TypeListRoute(store), childRoutes: [ TypeDetailsRoute(store) ] } ] }] })
次
createRoutes
の方法でconst routes = createRoutes(store) <Router history={browserHistory} children={routes} />
のように見えます
export class DashboardLayout extends React.Component { constructor (props) { super(props) this.children = props.children } render() { return ( <Layout theme={drawerTheme}> <NavDrawer pinned >...</NavDrawer> <Panel> {this.children} </Panel> </Layout> ) } }
は
TypeListRoute
は見えTypeContainer
が返さexport const TypeListRoute = store => ({ getComponent (nextState, cb) { require.ensure([], (require) => { const Type = require('./containers/TypeContainer').default const reducer = require('./modules/type').default injectReducer(store, { key: 'type', reducer }) cb(null, Type) }, 'type') } })
等から
Table
(Reduxのストアに)接続された「
が全く同じであるtoolbox`反応し、私はパスを指定TypeDetailsRoute
ここで
TypeDetailsContainer
返すものTable
とはまったく異なっています。あなたはこれを実現するためにLink
コンポーネントを使用することができます私は簡単なh1
にしようと、私はまだエラーに
私はあなたが非同期レデューサーをロードし、おそらく 'ストアを使用している参照してください。replaceReducer'である。それはうまくいくのですか?私は似たような行動を見たことがあります。減速装置の交換が間違っていて、コンソールに何らかのエラーが発生したため、ルートは変更されますが、新しいページは表示されません。 :) –
うまくいくようです。それは他のルートと一緒に働いていて、コンソールに単一のエラーはありません。 – ThomasThiebaud
プロジェクト全体のgithubリンクがありますか? –