Comment

Comment by Cafey

You may want to have a read at Redux (http://redux.js.org) or any Flux type of container.

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.

parent Cafey 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton