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

302
Vistas
React, trigger one modal to open when another closes

I'm working on implementing a modal which can open another modal. I have a user sign up modal which has a "Add Contact" button. Clicking this button triggers the "Add Contact Modal" to appear.

AddContactModal is an older component and is currently called in the App.js file right above the main Routes component.

<Router forceRefresh={!supportsHistory()}>
   <div className={appClassNames}>
     <Providers>
       <AddContactModal />
       <PhoneVerificationModal />
       <NavBar currentUser={this.state.currentUser} />
       <div className="app-content">
           {Routes(actions)}
           <Footer />
       </div>
   </Providers>
 </div>
</Router>

The Routes(actions) renders most of the application. AddContactModal also has all of its functions declared in a global context file so it can be opened from anywhere in the application.

My new modal SignUpModal lives on a particular route and has all of its functions in a local hooks folder.

-src
--context
----addContactModalContext.js
--scenes
----Contacts
-------addContactModal.js
----SignUp
------signUpHooks.js
------signUpModal.js

Because of the structure used I can call the function to open my contact modal from my signup modal. However I cannot reopen the signup modal from the contact modal.

I have tried adding event listeners to the signup page to listen for the contact modal submit and I was not successfully.

I know I could restructure things but that would be a pretty large endeavor.

Hoping someone has some advice. Ideally submitting the contact modal would trigger the sign up modal to open again ONLY when the user is on the sign up page.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe handle some state for your submit in your context, so it can be heard with an useEffect in your other component and it handles showing up the modal you need. Not sure if it would help but maybe it's a new idea.

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