Originally published at: https://michel.codes/blogs/ui-as-an-afterthought
A question people ask me regularly: “How do all the new React features (context, hooks, suspense) affect how we build (web) apps in the future? Do they make state management libraries like Redux or MobX obsolete?”
With this post, I’ll try to answer that question once and for all! To truly understand the question, we’ll need to do a little groundwork. Let’s step back, and leave React, Redux and MobX alone while we answer a more fundamental question.
What is a web application? For the purpose of this post: A web application is a user interface…
In the first part of this blog post series we discussed the advantages and disadvantages of snapshots, patches and actions when building applications in which we want to distribute state changes.
In this blog post we are going to build a simple distributed system that plays with these concepts. The goal of this exercise is not to build the best system possible, in fact, the system we are building is pretty naive and much better algorithms exist. The example is just a mental exercise to train ourselves in thinking in terms of terms of patches, actions and snapshots.
Link to Part 2: Distributing patches and rebasing actions using Immer
(this blog has a Korean translation here)
In the many projects I have maintained so far, sooner or later I always run into the same issue: circular module dependencies. Although there are many strategies and best practices on how to avoid circular dependencies. There is very little on how to fix them in a consistent and predictable way. Usually, people move import statements or blocks of code randomly around until “it suddenly works”. As it turns out, I am not the only one running into this problem, given the responses to this tweet:
Luckily, as I will demonstrate…
Princess Proxy looked down at the crowd approaching the balcony of the throne room.
“Be careful, they are after your values.” Her father had warned her. “But don’t worry, you’ll be ready for it.”.
But today, on her coronation day, she couldn’t help but feel nervous. Her father had told her this day would come almost three years ago. But back then she couldn’t fathom it. And now the day is here.
A hand was placed firmly on her shoulder. Her father. The king.
“Go, my daughter. Beloved Proxy. You are ready. …
I’m proud to announce that a new major version of MobX has been released! The changelog is quite long and includes a migration guide. So, in this blog post I’m just going to highlight the most compelling new features. Btw, if you are not familiar with MobX yet, make sure to check the free egghead.io course!
flowto further simplify asynchronous processes
onBecome(Un)Observedto automatically fetch data sources
And still; most of them don’t solve the root problem: lack of language support. For example, where
update-in is an elegant concept in a language like…
Many words, talks and articles have been dedicated to the question “should I be using Redux or MobX?” Even React books tend to discuss both nowadays. Yet there is no ‘winner’ and nor will there be (off-topic: it is even highly questionable if there is anything to ‘win’ in OSS in the first place). The reason for this is simple, both libraries yield completely different benefits. So your preference will be determined by your requirements and values rather than the intrinsic quality of either of them.
Now, since that has been settled, let me share why I like Redux.
A few weeks ago Bertalan Miklos wrote a very interesting blog in which he compared the proxy based NX-framework with MobX. That blog is not only interesting because it proves the viability of proxies, but even more because it touches some very fundamental concepts in MobX and transparent reactivity (automatic reactivity) in general. Concepts I probably did not elaborate enough on so far. So let me share the mental model behind some of the unique features of MobX.
The article touches a very remarkable feature (imho) of MobX: in MobX all derivations are run synchronously. Which is quite unusual. Most…
Lead Developer @Mendix, JS, TS & React fanatic, dad (twice), creator of MobX, MX RestServices, nscript, mxgit. Created.