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

268
Vistas
Conditional Operator for React Components, not updating

I currently have 2 Components that work conditionally, but i would like it to update and change when the createdSavingsGoal state array is greater than 0 (i.e Not empty)

Then it shows a List.. When its empty it shows a Form that allows me to Post to that array. Currently i have to refresh that page but i would just like it to work. automatically

Im not brilliant with State so if im doing something obvious.

this.state = {
  createdSavingsGoal: "",
};

..

render() {
const { createdSavingsGoal } = this.state;
if (createdSavingsGoal.length > 0) {
  return <ViewSavingsGoal />;
} else {
  return <CreateSavingsGoal />;
}
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