我已經從我的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' –