Answer the question
In order to leave comments, you need to log in
What is the correct approach in writing a modal window?
Create 1 reducer that will store the state of the modal window (open / closed), and make it reusable throughout the application. Throw other handlers for buttons through props (unless, of course, they are needed).
Or would it be more correct for each modal window to create its own reducer + component? For example: ModalProduct, ModalFilter, etc.
I think it's probably better to take the 2nd method, if suddenly there are 2 modals on 1 page, they will open all together. Suggest solutions based on your experience.
ps the project is quite large: a landing page, an account, an admin panel.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question