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

185
Vistas
What is the best way of assigning a variable from an object value in React?

I want to know what the better option is when getting values out of an object:

const [currentMonth, setCurrentMonth] = React.useState(getCurrentMonth(language).label)

or:

const { label: labelMon } = getCurrentMonth(language)
const [currentMonth, setCurrentMonth] = React.useState(labelMon)

I want to use the value only once to set the initial state.

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

0

You have to use this once it happens

 useEffect(() => {
const { label: labelMon } = getCurrentMonth(language)
   setCurrentMonth(labelMon )
  },[]);
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