Hacker News new | ask | show | jobs
by BreakfastB0b 2017 days ago

  You can write global reactions to state changes very easily.
This is exactly the problem, shared mutable state leads to "spooky action at a distance". It results in causal connections between parts of your codebase that are not reflected in the control flow of your code. If you have immutable unidirectional data flow causal relationships between parts of your code base must be reified in the control flow of the language.

  Most components do not have any async effects.
At least when using Apollo / GraphQL almost every component ends up with async effects.

I think this talk by Andre Staltz is the best explanation and solution of the problem https://www.youtube.com/watch?v=SXdtrhn8iII

1 comments

But the state is not mutable, the state is inside a React.Context that provides functions that manipulate it. It's practically the same as redux. You still need to have async actions with redux and use these actions.

mobx on the other hand is exactly that, the state is globally mutable, anyone can import it from anywhere to anywhere.