我已经从我的API中获取了组,并且我可以看到它们通过了UI和道具,但不知何故显示组的名称并未发生。在反应中使用道具映射
这是我如何映射它:
<List>
{this.props.groups && this.props.groups.map((g) =>
<ListItem key={g.Id} primaryText={g.Name} onClick={this.handleClickItem(g)} />) }
{(!this.props.groups || this.props.groups.length === 0) && "No groups found."}
</List>
redux devtools showing the data showing the props hold the data
我试过,其实没有任何运气。 当我console.log整个对象'g'然后它通过好,但当我尝试console.log(g.Name)它说undefined:/ – djohan
他说'g'没有一个属性'名称“,这就是为什么你没有定义。它是小写字母。尝试记录'g.name' –