Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!