【发布时间】:2019-01-23 01:05:39
【问题描述】:
数据:
{
“services”:[
{id: 1, title: ”title 1”},
{id:3, title:”title 3”},
{id:4, title:”title 4”}
],
“Blogs”:[
{id:2 title:”title 2”},
{id:5, title:”Services”}
]
}
我想在屏幕上显示这个数据
services :
id: 1, title: ”title 1”
id:3, title:”title 3”
id:4, title:”title 4”
Blogs :
id:2 title:”title 2”
id:5, title:”Services”
我写了下面的代码,但我得到了键值,但没有得到该键的数组。
{
Object.keys(data).forEach(function(key)
{
return (
<Text>{key}</Text>
)
})
}
如果有人知道,请提出任何解决方案。提前致谢。
【问题讨论】:
-
services.map((item, i) => {return ( <Text>{item}</Text> )试试这样
标签: arrays reactjs react-native hashmap