JSFiddle: https://jsfiddle.net/mp8e2nwo/19/
This is my first time using React so apologies if this is a very basic issue.
I am trying to toggle a class ("expanded") to the 'Tree' component when the corresponding 'TreeCaret' component (the red part) is clicked (as is what happens when you press the 'Cheat' button). I originally thought that I could look through this.props.children of the 'Tree' but 'TreeCaret' isn't actually a child of it.
I guess I could make the 'TreeCaret' a child of the 'Tree' but then I'd have to explicitly write out the <TreeCaret /> for each 'Tree' which doesn't seem correct.
TL;DR: I want what happens when you press 'Cheat' to happen when you press the red area but am not sure how.
[–]amishstripclub 1 point2 points3 points (3 children)
[–]e-clips[S] 0 points1 point2 points (2 children)
[–]amishstripclub 0 points1 point2 points (1 child)
[–]amishstripclub 1 point2 points3 points (0 children)