HN2new | past | comments | ask | show | jobs | submitlogin

Depends on what kind of component just updated. If it's a low level text field, it probably shouldn't broadcast the change to anywhere else in the program. Instead it would invoke it's 'onChange' callback. This way, there are no extra dependencies for making the text field component work. The parent component always provides the onChange callback and takes action accordingly.

However, if the component that just updated is high level, like an entire page or something, then it's reasonable to assume it's a one-off controller component and you should feel free to broadcast messages and couple the component with other parts of the program.

https://medium.com/@dan_abramov/smart-and-dumb-components-7c...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: