A
A
AlexKindGeek2018-11-13 22:18:20
React
AlexKindGeek, 2018-11-13 22:18:20

How to pass data to modal?

Hello. I have a table. When I select the element(s) and click on the modal button, I should have a modal open with inputs to change some of the selected element's data. Options for how I can pass data:
1. Pass selected from the parent state (table), write a handleChange function to change the data by index, and pass all this as props. The problem is that I have a rather large project with a large table and selected is passed to at least 2-3 components, so it will slow down.
2. Because on my Redux project, I thought to make a separate reducer for this modal, when you click on the button, make an action that will put selected data in that reducer. Subscribe the modal to connect and already manipulate the data.
The problem is, as for me, signing 1 modal on a separate page is not very good, although I'm not sure.
How should I proceed in this situation?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question