D
D
Destell2019-03-07 18:39:15
React
Destell, 2019-03-07 18:39:15

React. How to make an "individual" inject for a component in a component rendered via map?

There is a set of cards with data, displayed through map. A mobx store is connected to the card, with the help of which cards are edited, etc.
Each card gets its own store, which is also connected to the provider.
Then a problem arose - the card is divided into three components: the body, inpat and a panel with buttons that switch editing, save changes, etc. Just the buttons should receive the editing switching function from the card store.
However, if you inject into the buttons, then the store works for them globally (which is logical).
It turns out that there are only two ways out - to use props or transfer the buttons directly to the card? Is it possible to shift this completely to the shoulders of the store, leaving the structure in its current form?
git

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Laud, 2019-03-07
@kshshe

What's the problem? The buttons change the values ​​for their card in the store (by id or something else), the updated store reaches the card, the card is updated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question