我需要了解我用于学习目的的react-redux项目: 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 存储的配置方式/位置。
有人可以向我解释一下发生了什么,这家商店是如何运作的,以及如何为该项目创建一条私人路线吗?
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'));