Skip to content
Advertisement

How to use multiple material ui dialog with React?

I want to use two dialog in sign up page and login page. the implement that I want to do are signup screen showing up when click to sign up button on the Top page, and login screen showing up when click to login Button on signup page.

I wrote open state on App.js. but the trouble is when it’s written in App.js, two of modal open..

Does anyone know how to settle it?

App.js

JavaScript

Top.js

JavaScript

SignupModal.js

JavaScript

LoginModal.ls

JavaScript

Advertisement

Answer

You are sharing the state on both of your modals that’s why.

The solution is simple, have 2 states; one that will determine if SignupModal is opened or not and another one for LoginModal.

JavaScript
JavaScript

Edit priceless-sara-lvjnv

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