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

164
Vistas
Render problem when lifting state up in React

After reading the documentation and good practices. I decided to lift up the state in my code for a specific page. When I do this, I cause my app to be laggy because now every time I am updating a specific field in a form, it triggers to re-render every others forms field along with other widgets.

I tried to use, memo on each of my components but apparently it has no effect and the re-render is triggered each time.

The problem is that the component in the picture is very 6 levels down compared to where I am declaring and updating the state. So, when I want to update the value of this specific component, bassically, it setState my whole page. A example of one of my component

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

0

useEffect hook without dependency, will continue to render your component again and again, So if you want to render your component once use useEffect with empty array as dependency like this -

useEffect(()=>{
  //code will run once after rendering
},[]);

and if you want to re-render a component base on some condition then you can use useEffect with the dependency, if that dependency value is change it will trigger the component to re-render. For eg:-

const [dependency,setDependency] = useState();

useEffect(()=>{
  //when value of dependency will change, code will run and trigge render
},[dependency]) 
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