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

103
Vistas
Proper way of calling onChange function in React Final Form

According to React Final Form documentation, I can pass onChange callback to <FormSpy /> component to execute code when form state changes. However, I also discovered that if I need to run some function every time when the form changes, I can also put this function inside Form's render callback before return statement:

<Form
   onSubmit={onSubmit}
      render={({ handleSubmit }) => {
         myFunctionToRunOnChange(); // Call function here
         return (
            <form onSubmit={handleSubmit}>
               <div>
                  <label>First Name</label>
                  <Field name="firstName" component="input" placeholder="First Name" />
               </div>
               <button type="submit">Submit</button>
            </form>
        );
   }}
/>

Is it good practice? For example, comparing with using FormSpy for onChange...

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