lundi 15 mars 2021

React js get child state

I want to ask if there is a possible pattern to access a child state from parent. For example I have an array of childs rendered in the Parent component, but now I want to access the state of each child of the list from the Parent, I used ref but it works only with the last element.

I hope the problem is clear, thank you.

(I know I can solve it with Redux, but it is complicated because the list can change its size dynamically)

Aucun commentaire:

Enregistrer un commentaire