▲ | zahlman 5 days ago | |
Interesting to contrast that with the assessment of React, qua critique of the Observer pattern in Brandon Rhodes' 2022 design patterns talk: https://www.youtube.com/watch?v=pGq7Cr2ekVM?t=28m45s . (Notably, later in the talk when he describes the Mediator pattern with a GUI-motivated example, he preempts by saying "I know I just told you to use React"... but then the description ends up sounding to me very much as if React is an implementation of the Mediator pattern!) | ||
▲ | CharlieDigital 5 days ago | parent [-] | |
All modern FE frameworks are effectively observer patterns, it's that there are two camps on how those changes in the state are propagated. In signals-based platforms (Vue, Svelte, Solid), the signal targets specific subscribers and callbacks where the developer has opted in to state changes. In React, though `useEffect` looks a lot like Vue's `watch`, they behave entirely differently because the entire component is registered as the callback. The code examples in my second link [1] above are worth a glance because it makes it very obvious how similar these libraries are when glancing at the code, but how different they are in terms of how they deliver update signals. |