我可以从网站扩展中看到我想要的redux状态的所有数据,然而,当我想把它拉出来用在我的组件中时,它说this.props.rules是未定义的: 下面是create-store.js: import {createStore, applyMiddleware} from 'redux';
import mainReducer from './reducers/main-reducer';
import {composeWithDevTools} from 'redux-devtools-extension';
import thunk from
假设我有一个subcategoryContainer.js,它正在向subcategory.js传递道具,现在subcategory.js中导入了另一个组件filter.js。此filter.js正在接收来自subcategory.js的道具。数据来自存储。这里redux thunk是异步更新存储。
现在的问题是把道具放到filter.js的状态。初始状态设置为空对象。即使我在componentWillReceiveProps方法中更新状态,我也只能在render()中得到空对象,而不是应该包含属性数据的更新状态。
这是触发方法的顺序。
1.render() // initial data f
我有一个diches.js,其中包含我希望在maincomponent.js中使用的数据列表。我编写了这个reducer.js来接收数据列表 import { DISHES } from '../shared/dishes'; // deux l'un pour sortir de ce fichier et l'autre pour sortir de ce dossier
import { COMMENTS } from '../shared/comments';
import { PROMOTIONS } from '../sha
我有以下两项测试
import {put, select, takeEvery} from 'redux-saga/effects';
import {combineReducers} from 'redux';
export default class SessionReducer {
public static readonly _initialState: any = {
disconnectCounts: {},
};
public static reducer(state: any = SessionRedu
我在学习Redux的时候偶然发现了createStore函数。因此,据我所知,createStore接收3个参数:
reducer
initial state
enhancers (for simplicity we will use only middlewares)
但是当我们实际使用createStore时,我们不会传递初始状态作为第二个参数,而是传递带有默认状态的reducer,如下所示:
const initialState = {counter:0}
const reducer =(state=initialState, action)=>...
问题是,为什么我们不把初始状