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

267
Views
¿Cómo puedo usar el gancho useFormikContext en mi componente de clase?

Estoy trabajando con formularios Formik en la aplicación React Native. Quiero que mi formulario se envíe usando un botón que está fuera del componente Formik. Sé cómo funciona el enlace useFormikContext, pero el problema está en mi componente, que es un componente de clase (no un componente funcional). ¿Cómo puedo enviar mi formulario?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tengo que usar React.createRef() para resolver mi problema. He creado la referencia en el constructor de esta manera

 this.myRef = React.createRef();

entonces tengo que aplicar la propiedad ref interior a mi formulario de esta manera

 innerRef={this.myRef}

y finalmente tengo que llamar al método submitForm en mi handleSubmit así

 this.myRef.current?.submitForm();

Eso es todo :)

about 4 years ago · Juan Pablo Isaza Report
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!