React native 为什么我不能直接访问React Native[REDUX]中的数组对象
我想知道为什么我不能直接从mapStateToProps访问数组中的对象,但我可以在使用map函数时访问 //工作React native 为什么我不能直接访问React Native[REDUX]中的数组对象,react-native,redux,React Native,Redux,我想知道为什么我不能直接从mapStateToProps访问数组中的对象,但我可以在使用map函数时访问 //工作 <View> {this.props.m.map((item,index) => { return( <Text key={index}> This is my fixed footer! {item.title} </Text> ) }) } </View> //不起作
<View>
{this.props.m.map((item,index) => {
return(
<Text key={index}>
This is my fixed footer! {item.title}
</Text>
)
})
}
</View>
//不起作用
<Text>
{this.props.m[0].title}
</Text>
我发现以下错误:
我使用redux thunk中间件来使用异步函数和action creator。问候 M不是数组,它只是一个可编辑的对象,这就是为什么映射可以工作,而访问M[0]则不行,请尝试使用array=M.values,现在array包含了来自M的所有值,现在可以执行array[0]