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

178
Vistas
How to inherit and overide object in JS

I have a react StyleSheet with objects

  const styleSheet = StyleSheet.create({
    picture1: {
      height: 50,
      width: 30,
      alighItems: 'center',
    }
    picture2: {
      height: 50,
      width: 50:,
      alighItems: 'center',
    }
  })

My question is : How do I assign properties of picture1 to picture2, and ovveride width to 50?

So I could write just picture2: {width: 50} without having to rewrite same code?

I tried this way but unfortunately it didn't work.

 const styleSheet = StyleSheet.create({
    picture1: {
      height: 50,
      width: 30,
      alighItems: 'center',
    }
    picture2: {
      ...picture1,
      width: 50:,
    }
  })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  const picture1 = {
    height: 50,
    width: 30,
    alignItems: 'center', // Note: alignItems not alighItems!
  }
  const styleSheet = StyleSheet.create({
    picture1,
    picture2: {
      ...picture1,
      width: 50,
    }
  })
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