4 ms·
>Reactive programming frameworks that execute callbacks in response to events can cause really weird bugs if the callback mutates state somewhere What's the po
by thfuran 3y ago
>Reactive programming frameworks that execute callbacks in response to events can cause really weird bugs if the callback mutates state somewhere
What's the point of a callback that doesn't mutate state somewhere?
- andyferris 3y agoA lot of “dependency injection” type frameworks run this way. The framework or runtime calls your function, and the return value tells it what to do next. Prominent examples include React and Excel.
- mightybyte 3y agoIt allows you to separate non-stateful business logic from the stateful update logic. Reactive frameworks usually handle the state mutation for you, eliminating the potential for UI glitches where something that depends on the updated state doesn't get recomputed/redrawn.