Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

React developers wrote about this here: https://legacy.reactjs.org/docs/design-principles.html#sched...

Let me try to explain this differently:

A typical reactive framework architecture (RX, Knockout, etc) looks like this

Events -> Observables -> Computed values -> Subscriptions -> DOM updates

It aims to provide a targeted DOM update in response to event as soon as possible, but it has several major disadvantages:

1. Batching and prioritizing capabilities either don't exist, or are limited and generic, in particular by default they are not tied to UI structure, because the framework itself doesn't want to be aware of UI structure, it just wants the framework user to provide event sources and write update targets manually.

2. Computed values are computed if corresponding subscriptions are active. In contrast, React hides state propagation logic inside the component tree, so the computation happens only when components are actually rendered.

Issue 1 is not relevant for MobX-React case, because React is doing UI update batching and prioritisation. But issue 2 is very real, especially when using React Router. I had multiple cases where Computed values were computed at unexpected point in time and used observable values that were not initialised, while corresponding React components were not even visible on the screen.



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

Search: