我没有在我的嵌套映射函数中找到解决此错误的方法,我尝试的所有内容都以 sintax 错误告终。
我的代码:
{import codes....}
const FormScreen = ({route}) => {
const [FieldForm, setFieldForm] = useState([]);
const [TypeForm, setTypeForm] = useState([]);
useEffect(() => {
if (FieldForm.length > 0) {
return;
} else {
setFieldForm(JSON.parse(route.params.paramKey).message);
setTypeForm(JSON.parse(route.params.paramKey).tipo);
console.log('SETINGGG',FieldForm,TypeForm);
}
},[FieldForm,TypeForm]);
return (<View>
{FieldForm.length > 0 ? (
FieldForm.map((item) => (
<>
<Text>{`${JSON.stringify(item)}`}</Text>
<>
{TypeForm.map((type) => (
<Text>{`${JSON.stringify(type)}`}</Text>
))}
</>
</>
))
) : (
<Text key={uuid.v4()}> Loading ...</Text>
)}
</View>
我试图删除这些组件但它不起作用,我怎样才能让它工作?
最佳答案
{TypeForm.map((type) => (
<Text>{`${JSON.stringify(type)}`}</Text>
))}; // remove this ; (dot and comma)
关于javascript - 如何解决文本字符串必须在嵌套 map 中的 <Text> 内呈现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70174554/