【发布时间】:2021-07-25 17:03:45
【问题描述】:
我不知道问题出在哪里。我无法解决此错误
import { View, Text, text, TextInput, password, Image, } from 'react-native';
import React, { useEffect, useState, Component } from 'react';
import { FontAwesome } from '@expo/vector-icons';
import { AntDesign } from '@expo/vector-icons';
import { Container, Header, Content, ListItem, CheckBox, Button, Body, Grid } from 'native-base';
import Mycard from './Mycard'
import { getMatches } from './Api';
export default function Home() {
//code
const [matches, setmatches] = useState([]);
useEffect(() => {
getMatches()
.then((data) => {
setmatches(data.matches);
console.log(data.matches);
})
.catch((error) => alert("could not load data"));
}, []
);
// where is the problem ?
return (
<View style={{ flex: 1,}}>
<Grid Container>
<Grid></Grid>
<Grid>
{
matches.map((match)=>
(<Mycard match="match" />)
)
}
</Grid>
</Grid>
</View>
)
}
渲染没有返回任何内容。这通常意味着缺少 return 语句。这里似乎有什么错误?
【问题讨论】:
-
问题可能出在另一个组件上。例如,检查 MyCard 组件。渲染有回报吗?
标签: reactjs react-native render