How are events in React supposed to be propagated from low level components to their parent components when the low level components should not have any knowledge of their parents?
How are events in React supposed to be propagated from low level components to their parent components when the low level components should not have any knowledge of their parents?
There's a great article that describes various component communication patterns at http://andrewhfarmer.com/component-communication/ .
Basically, you don't propagate directly to your parent. In React there should be only one source of truth. So in your case, the event in a low level component should emit an action that will modify data in your Store/Container/Model. Then this change will be passed down (with the correct setup) as props to all of your components.
>React best practises question - At what level should event handlers be installed? At lowest level components or the highest level?
I personnally prefer when the handlers are close to the associated JSX. I doubt there is any requirement on this other than maintainability.
He was asking for best practices, certainly a sizable amount of developers would argue to use a flux implementation for that particular problem, as a best practice.
In this particular case it would be totally OK if the answer included Redux. Because, like you said, it is relevant. But it should go something like "Pass event handlers from parent to child component. If you find a lot of components are merely passing through a lot of data and event handlers to child components without using it you should have a look at Redux".
You should have a look at acemarke's response and neurostimulants follow-up, together they answered this question perfectly.