我正在爲一個項目創建一個Landing頁面,並希望通過輔助函數來顯示我的四種不同紙張組件來減少我的代碼。除了在論文中顯示我的Icon組件外,一切似乎都正常工作。動態更改React組件標籤
當我安慰日誌Icon這是正確的文本,但該組件不會出現在網頁上,我收到這兩個警告,每個組件標籤:
"Warning: The tag <CardTravelIcon> is unrecognized in this browser. If you
meant to render a React component, start its name with an uppercase letter."
和
"Warning: <CardTravelIcon /> is using uppercase HTML. Always use lowercase
HTML tags in React."
如果我只是在CardTravelIcon或其他3種組件名稱中使用該確切格式進行硬編碼,而不是使用我的地圖功能中的Icon,則一切都按預期工作。以下是我的幫手功能的代碼:
class Landing extends Component {
renderPapers() {
const classes = this.props.classes;
return _.map(infoPapers, ({ description, Icon }) => {
return (
<Grid item xs={6} sm={3} key={Icon}>
<Paper className={classes.paper}>
<Icon className={classes.paperIcons} />
{description}
</Paper>
</Grid>
);
});
}
我很茫然,很感激任何幫助。謝謝。
請問您可以發佈this.props.classes的輸出嗎? –
我爲我的網站設計使用材質用戶界面,他們使用this.props.classes作爲定製樣式的方式 –