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

198
Views
No se puede redirigir la página en el envío del formulario en reaccionar

Estoy tratando de hacer una llamada API y redirigir una página al enviar el formulario usando React. Aquí hay algunas cualidades del problema con el que me estoy topando:

  • Todo lo que sucede al enviar el formulario es que la página se vuelve a cargar.
  • Si configuro la función de envío para que se ejecute al hacer clic, redirigirá la página como se esperaba
  • Todo lo demás en la función se ejecuta como se esperaba al enviar

Eliminé el código API porque es irrelevante para esta pregunta:

 const Booking = () => {
 const handleSubmit = () => { window.parent.location = '/intuit-app/thankyou';}
 return ( <> <Container> <FormWrap> <Icon to="/intuit-app">Intuit</Icon> <FormContent> <Form onSubmit={handleSubmit}> <FormH1>Enter your email, then pick a date and time for your consultation</FormH1> <FormLabel htmlFor='for'>Email</FormLabel> <FormInput type='email' onChange={handleInputChange} required /> <FormButton type="submit" value="Submit" >Submit</FormButton> </Form> </FormContent> </FormWrap> </Container> </> ) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Olvidó evitar el comportamiento predeterminado del navegador.

 const handleSubmit = (event) => { event.preventDefault(); window.parent.location = '/intuit-app/thankyou'; }
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!