重定向到另一个页面后保留 redux 存储值



当用户点击链接时,它将引导用户进入结帐页面。

selectSlot(slot){
    window.location = `/checkout/${slot.target.value}`
}

我的方法不会保留 redux 存储值。如何保留这些值?

以下是路由器定义

    <Provider store={store}>
        <ConnectedRouter history={history}>
            <Router>
                <Switch>
                    <Route exact path="/" component={MainLayout} />
                    <Route exact path="/index.html" component={MainLayout} />
                    <Route path="/checkout" component={CheckoutLayout} />
                    <Route component={NotFound}/>
                </Switch>
            </Router>
        </ConnectedRouter>
    </Provider>

我正在使用react-router-domLink来达到目的并且对我有用。你可以在这里阅读它

最新更新