Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
How to set object value one by one in into text field using map function in reactjs

I render textfile using the map function according to my array. Now I have an object and I need to set this object value into rendered out text field one by one. But I don't know the way to do this.

This is my object -

const myObject={en: 'This is a good store', fr: "C'est un très bon magasin", ja: 'これは完全に良い店です'};
     {
        locals.map((item, index) => {
           return basicDetails(item, index, myObject);
         })
     }

const basicDetails = (item, index, myObject) => {
    return (
        <Grid>
             <Grid item xs={12}>
                    <CssTextField
                        value={myObject}
                        autoFocus
                        fullWidth
                        variant="outlined"
                        label="Shop Tagline"
                    />
              </Grid>
    );
};

I just need to set my object value one by one into a textField. I try to do this my result is [object Object].

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're getting [object Object] because the value you're passing to the CssTextField component is your entire object instead of one of its attributes.

I'm not sure what locals contains but my guess would be that you need to change this

locals.map((item, index) => {
 return basicDetails(item, index, myObject);
})

to this, assuming locals is an array that contains values such as ['en', 'fr', 'ja'].

locals.map((item, index) => {
 return basicDetails(item, index, myObject[item]);
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda