标题 有谁知道如何在 React js 中映射字典?
export class ServiceFeatures extends React.Component {
constructor(props) {
super(props)
this.state = {dict: {'awesome': ['wow','alo'], 'great': ['ano', 'alo' ]}}
}
render() {
return (
<div>
{this.state.dict.map((name, features) => (
<Services categories={features}></Services>
))}
</div>
)
}
}
原文由 David Vittori 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以使用
Object.keys
映射对象的键。