如何在React Native中映射来自Axios的数据?

问题描述

我正在使用Axios从API获取数据。 我想使用地图功能在Axios的提要中循环浏览所有项目,并获得标题。但是我不知道如何映射它,因为我的Feed具有items[0].titleitems[1].title ...

这样的结构
const URL = 'https://api.RSS2json.com/v1/api.json?RSS_url=https%3A%2F%2Fvnexpress.net%2FRSS%2Fthe-gioi.RSS';

    let content = null;
    const [Feed,setFeed] = useState(null);

    useEffect(() => {
        axios.get(URL).then((response) => {
            setFeed(response.data);
        });
    },[URL]);

if(Feed) {
     /// To get title of first item: content = <Text>{Feed.items[0].title}
    content = 
            
                Feed.map(f => {
                return <Text>{f.items[???].title}</Text>   /// How to loop through all the items[0].title,items[1].title,items[2].title ?
                })
            
}

return (<View>{content}</View>);

编辑;

enter image description here

解决方法

如果您有Feed数组

effectsize
EtaSq()

如果总是得到一个Feed,

DescTools