Fork me on GitHub
#react
<
2021-04-16
>
ordnungswidrig13:04:32

@raspasov what about an approach like cursors/subscription? You still “predent” to have a global and pure sate but enable isolated and faster change for these components?

raspasov16:04:19

The discussion about cursors/subscriptions can be a long one. But the short answer is: I’m not convinced “subscriptions” are a good abstraction.

raspasov16:04:29

There was an analogy from a Rich Hickey talk. It goes something like: “if we are all watching a game at the stadium, we can all watch uninterrupted. Nobody needs to “subscribe” to the game.” I’m generally very weary of abstractions that try to simulate the wrong physics and “subscriptions”, as commonly described, seem to me to fall in that category.

ordnungswidrig08:04:26

To me cursors is about two things: • focus (think “lens”) on a specifiy part of the global state for isolation (component does not need to know where in the global state to main it’s state) • isolation (does the components state affect the global state)

ordnungswidrig08:04:39

For performance reasons the latter can be interesting.

ordnungswidrig13:04:17

IOW having a state like {:foo :bar :sub {:something "different" :fast-paced-counter (atom 0)}} ?

orestis16:04:17

Reseda has subscriptions for this kind of thing.