javascript - 如何解决文本字符串必须在嵌套 map 中的 <Text> 内呈现?

标签 javascript react-native jsx

我没有在我的嵌套映射函数中找到解决此错误的方法,我尝试的所有内容都以 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/

相关文章:

javascript - 将 react 组件数组映射为两个元素的组

css - react 原生 flex 和宽度百分比不同

javascript - 如何在 hello world 前 5 秒显示事件指示器

javascript - Jquery 中显示/隐藏文本框的问题?

javascript根据标题数量将数组复制到新数组中

android - 如何在启动 React Native Activity 时发送数据?

javascript - 如何在 react 中动态获取宽度?

reactjs - 意外的关键字 'this' Reactjs jsx

javascript - 对象 bool 函数的问题

javascript - 在子类上调用 super() javascript throw Error