E
E
Elena2022-01-04 15:49:23
React
Elena, 2022-01-04 15:49:23

Implementing opening and closing multiple modal windows?

What is better to do for this: make a state variable for each popup and change the state through useState or make a global state in the editor, where all popups will be stored and their state changed through dispatch?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2022-01-04
@Elena0394

If the application already has Redax, it is better to store the state there, if not, I would use the Context API
. The latter will allow you to make a separate provider for modals and manage only them without mixing states.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question