我正在尝试创建一个新的reducer,遵循当前构建中其他代码的格式,而state在新的reducer中是未定义的。当我尝试console.log(this.props)时,我试图传入的状态没有出现(即没有引用choroplethData)。// the new reducer file reducers/chart.
我目前正在做一个使用Redux和React的教程,并决定用Typescript来做。我收到一个编译错误,我的商店的状态是{posts: PostType[]}类型。'{ posts: PostType[]; } | undefined' is not assignable to type '{ posts: PostType[]; }' 我不确定该怎么做,因为在我自己的代码中,我并没有显式地建议post可能是未定义</em
我创建了一个像这样的商店:const store = createStore(reducers, initialState)
我确保定义了defaultConfig和data,也就是说,我真的在语句之前停止了调试器,并且我可以确认配置是否真的存在。然而,在reducers内部,状态是undefined。为什么?!const reducers = combineReducers({config: co