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

128
Views
No se puede mapear sobre datos ficticios

Estoy creando un componente mapeado con algunos datos ficticios en la interfaz. Solo tengo algunos datos rápidos que estoy extrayendo de un archivo js

 export const userInputs = [ { id: 1, label: "First Name", type: "text", placeholder: "Remy" }, { id: 2, label: "Surname", type: "text", placeholder: "Sharp", }, { id: 3, label: "Email", type: "email", placeholder: "remysharp@gmail.com", } ]

Luego estoy alimentando esto como un accesorio de 'entradas', como tal

 <UserProfile inputs={userInputs}/>

Tengo esto pasado como accesorios para mi componente, sin embargo, cuando trato de mapear esto como:

 <UpdateUserDetails> {inputs.map((input) => ( <FormInput key={input.id}> <UserInput type={input.type} placeholder={input.placeholder}> </UserInput> </FormInput> ))} </UpdateUserDetails>

Recibo el siguiente error × TypeError: No se pueden leer las propiedades de undefined (leyendo 'mapa')

¿Qué me estoy perdiendo?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Principalmente uso React native (Expo: https://docs.expo.dev/ ) ahora, por lo que mi código se ve un poco diferente, pero parece que solo te faltaba el índice. Siéntete libre de jugar con lo siguiente

 import { StyleSheet, Text, View, TouchableOpacity } from 'react-native' export const inputs = [ { id: 1, label: 'First Name', type: 'text', placeholder: 'Remy', }, { id: 2, label: 'Surname', type: 'text', placeholder: 'Sharp', }, { id: 3, label: 'Email', type: 'email', placeholder: 'remysharp@gmail.com', }, ] export default function App() { return ( <View> {inputs.map((input, index) => ( <TouchableOpacity key={input.id}> <Text>{inputs[index]?.label}</Text> </TouchableOpacity> ))} </View> ) }

Acabo de colocar entradas de userInputs como inputs en el mismo archivo por motivos de simplicidad.

Espero que esto ayude. ¡Que tengas un gran resto de tu noche!

about 4 years ago · Santiago Trujillo 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!