Reputation: 355
I have Parent component containing two child component.
<Parent>
<Child1></Child1>
<Child2></Child2>
</Parent>
In Child2 component I have one Ul
(unorder list), in which I have given ref="mylist"
.
<ul ref="mylist" className="list"><li>Test1</li><li>Test2</li><li>Test3</li></ul>
So how can I access mylist
from Child1
component and get list values.
Upvotes: 0
Views: 606
Reputation: 1542
You may consider to store values inside Parent component and pass them as props to children.
Upvotes: 1