Skip to content
Advertisement

Replace Second Modal with First Modal

First Check my react-bootstrap codes:

JavaScript

I need to show second modal then hide first modal after clicked on the button on first modal.

You can see demo here: https://codesandbox.io/s/xenodochial-joliot-jl3qe

the problem is the both of modal was hide when click on the button on first modal.

maybe i need to use redux in this case ?

Advertisement

Answer

so we need to track the statuses for the 2 modals… the only difference being that since modal-2 can be triggered from inside modal-1, we need to make sure that we close modal-1 when we are displaying modal-2;

I showed the statuses on the screen so that it becomes easier to track and understand;

following is the relevant code:

JavaScript

complete working example forked off your code-sandbox here

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement