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

95
Vistas
Best way to pass mutate state in children components then use it in the parent component and use memoization

I have a page that is compiled with 3 form components I want the parent page to have the state and pass through the state to child components then I want to mutate the state in the forms and then use them in the parent component I currently doing it in a way similar to as shown below but I am not sure if this is the best approach to handle state in child components is there a better way ? Also I want to memoize the form components with react.memo to prevent them from re-rendering unless the props have changed. Any help would be much appreciated


const [form1, setform1] = useState<boolean>(false);
const [Form2, setform2] = useState<string>("");
const [form3, setForm3] = useState({});
<form1 form1={form1} setfrom1={setform1} otherProps={otherProps} />
<form2 form2={form2} setfrom2={setform2} otherProps={otherProps} />
<form3 form3={form3} setfrom1={setform3} otherProps={otherProps}/>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Also, you can use Context API. If your other props are similar for your forms it will be the best solution for your.

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