DEV Community

Discussion on: Redux is half of a pattern (1/2)

Collapse
 
jwp profile image
John Peters

This complexity vaporates when we stick to the much simpler event, eventhandler pattern. Events emit data and subscribers handle the notification. Components are small and only do one thing. For example, a Person component works with a Person model and A person object. That's it. This component is responsible to get the person object, subscribe to the result in populate the person model. Later it may contain a FindPerson function which has a well defined input and output interface. The person component grows over time and may provide notifications at any time. Because events are loosely coupled, what happens next is of no concern to this component. Simple concept, used by every browser in the industry why not follow what already works? Event s have been around for 50 years. They are the original observer pattern.