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

112
Vistas
Pass nested object to component as props and then map the data

I have fetched some data:

const data = {
  type: "footer",
  company_data: {
    phone: "123456",
    email: "hello@site.com",
    page1: {
      title: "Terms & Conditions",
      url: "/terms-conditions/",
    },
    page2: {
      title: "Privacy Policy",
      url: "/privacy-policy/",
    },
  },
};

I use the component like this:

<Footer data={data} />

The component:

export default function Footer({ data }) {
  return (
    <div>
      {data.type}
    </div>
  );
}

Great! This prints the type: footer. However if I try to map with Object.entries I get an error:

Error: Objects are not valid as a React child (found: object with keys {phone, email, page1, page2}). If you meant to render a collection of children, use an array instead.

OK so I can't use an object as a React child. I have tried converting to array using Object.entries(data); however, this still returns the same error as it's keeping the objects inside the array.

Any help on how I can get a useable array or object to use in the component with keys and values intact would be greatly appreciated.

about 4 years ago · Juan Pablo Isaza
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