Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
¿Hay alguna manera de usar un mapa dentro de otra función de mapa?

Lo que estoy tratando de hacer es después de un nombre de campo, quiero mostrar su tipo, que está en otro estado, como puede ver:

mi código:

 const FormScreen = ({route}) => { const [FieldForm, setFieldForm] = useState([]); const [TypeForm, setTypeForm] = useState([]); useEffect(() => { if (userForm.length > 0) { return; } else { setFieldForm(JSON.parse(route.params.paramKey).fields); setTypeForm(JSON.parse(route.params.paramKey).type); console.log(FieldForm,TypeForm); // returns me: {"message":["ab","test"],"tipo":["Date","Text"]} } },[userForm,TypeForm]); return ( <SafeAreaView style={{flex: 1}}> <View> <Text>COLLECTION :</Text> {FieldForm.length > 0 ? ( FieldForm.map((item) => ( <Text key={uuid.v4()}>{item}</Text> //Here I want to to map which type is the field(to use conditionals to render) but how can I make it? )) ) : ( <Text key={uuid.v4()}> Loading ...</Text> )} </View> </SafeAreaView> ); };

¿Cómo puedo usar un mapa dentro de un mapa para hacerlo, o crear una llamada api para devolver el tipo de los campos?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Definitivamente puedes anidar las funciones del map :

 const FormScreen = ({route}) => { const [FieldForm, setFieldForm] = useState([]); const [TypeForm, setTypeForm] = useState([]); useEffect(() => { if (userForm.length > 0) { return; } else { setFieldForm(JSON.parse(route.params.paramKey).fields); setTypeForm(JSON.parse(route.params.paramKey).type); console.log(FieldForm,TypeForm); // returns me: {"message":["ab","test"],"tipo":["Date","Text"]} } },[userForm,TypeForm]); return ( <SafeAreaView style={{flex: 1}}> <View> <Text>COLLECTION :</Text> {FieldForm.length > 0 ? ( FieldForm.map((item) => ( <> <Text key={uuid.v4()}>{item}</Text> <> {TypeForm.length && TypeForm.map((type) => ( // Return node )) || null}; </> </> )) ) : ( <Text key={uuid.v4()}> Loading ...</Text> )} </View> </SafeAreaView> ); };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!