Show me how you could easily use rxjs observables in it and ill be sold.

I played with SolidJS for a while because it was super easy to integrate observables in the components just by doing `const active = from(accounts.active$)`

And for react I've gotten it down to as simple as `const active = use$(accounts.active$)` or `const events = use$(() => pool.subscription(relay, ...), [relay])

Reply to this note

Please Login to reply.

Discussion

Here's an example from https://github.com/coracle-social/nonboard using svelte stores:

```

unsubscribe = state.subscribe(s => m.redraw())

```

Mithril uses a virtual dom, so this isn't much worse than react to begin with. To avoid re-calculating sub-trees (since rendering happens starting from the top) you might use `onbeforeupdate`, or `m.render` to isolate stuff more manually. I haven't gone that deep yet, but I'm sure it's possible.

To explain the example: that just listens to the global state store and redraws when it changes. You could do the same with a `use` helper that registers/unregisters observables/stores

I threw a proof of concept together to satisfy both our curiosity: https://github.com/staab/mithril-granular/blob/master/index.html

This allows you to call `this.use` in a component. It's not quite as clean as react/svelte, because it's less magical. The `onbeforeupdate` method is also a footgun as written (since it would prevent stateful child components from re-rendering), but that's an optimization anyway. Also see https://mithril.js.org/stream.html for mithril's own reactive solution. I'll have to give it a real try sometime.