【发布时间】:2018-03-01 19:40:48
【问题描述】:
render() {
return (
<SettingPanel>
{!loading && _.forOwn(accessLogs, function(groupedLogs, date) {
console.log(date);
console.log(groupedLogs);
console.log("=====");
return <DayLog date={date} accessLogs={groupedLogs} />;
})}
</SettingPanel>
);
}
这段代码为我生成了这个客户端错误:
warning.js:33 Warning: Failed prop type: Invalid prop `children` supplied to `SettingPanel`.
in SettingPanel (created by AccessLogsPanel)
in AccessLogsPanel (created by inject-AccessLogsPanel-with-teamStore-accessLogsStore)
in inject-AccessLogsPanel-with-teamStore-accessLogsStore (created by TeamSecurity)
我犯了什么明显的错误?我只想为accessLogs 中的每个键渲染一个<DayLog /> 组件。
【问题讨论】:
-
你的 SettingPanel 组件是什么样子的
-
在
SettingsPanel中,我在 div 包装器之间渲染{children}。 -
您能否也粘贴
SettingPanel的代码,它是否定义了PropTypes?也是SettingsPanel还是SettingPanel
标签: javascript reactjs lodash render forown