1

我需要关于我用于学习目的的 react-redux 项目的 helo: https ://github.com/arshdkhn1/ecommerce-site-template

我不明白的是redux store是如何提供的。

我可以看到 configureStore.js 文件,但在整个项目中没有引用它。我错过了什么吗?

事实上,我需要了解它是如何工作的,因为我正在尝试像本教程一样创建受保护的路由: https ://github.com/Remchi/reddice/blob/master/client/utils/requireAuth.js创建一个高阶组件并使用 react-redux 的 connect 函数。不幸的是,我收到了这个错误:

在此处输入图像描述

可能是因为 redux 存储的配置方式/位置。

有人可以解释一下发生了什么,这家商店是如何运作的,也许如何为该项目创建一条私人路线?

4

1 回答 1

1

index.js 应该引用 configureStore.js 并const store = configureStore();在渲染调用之前有一个类似的调用。就像是

....
import configureStore from './path/to/configureStore';
....
....
const store = configureStore();
ReactDOM.render(
   <Prodvider store={store}>
     <App/>
   <Provider>, document.getElementById('root'));
于 2017-10-13T19:28:35.370 回答