React and MobX-state-tree. Building a simple app with this excellent alternative to Redux. There are alternatives to Redux like: Mobx with its derivative, MobX-state-tree; Recoil; Akita; Vanilla React Context API. MobX-state-tree is an opinionated state management framework based on MobX

For the past 6 years, React has been my go-to solution for developing web interfaces. Its concepts are simple to grasp, and I also love the ability to build your own stack around this to build your interface.

That flexibility comes at a cost, however — there are so many choices to cover each aspect of your application that it’s impossible to start experimenting with all of them to figure out what is the most suitable technology for your website.

State Management solutions for React

Nowadays, frontend web applications behave more like desktop applications than old school apps. The state is saved in variables inside the code that is running on the browser. With the advent of Single Page Applications powered by React and Angular frameworks, global state management became increasingly important. Also, frontend applications become bigger and bigger as time passes and the industry moves on. Holding user preferences, site-wide selections, and having a reactive user interface became a necessity. There are very few things that have more impact on your project than the choice of state management.

For the past 5 years or so, Redux (developed in 2013) has been a de-facto standard when considering a state management system. It changed the way React applications were being developed (although it is framework agnostic). It allowed scaling a React application to a previously unmanageable level due to its complexity with state management and props passing between components in different places of the frontend application.

Its massive adoption has become so widespread that many people are not sure why they are using it, and bad practices are all over the place. So much so that the creator of Redux officially made a blog post explaining that Redux is not a panacea and that you might not need it in the end.

…and I have to admit it: I wouldn’t say I like Redux very much. I am still using it in many projects — I like how it integrates with React and its hooks. However, there are alternatives like:

I’m sure I forget something. And I won’t tell you that I have used all of them. But I have used Mobx and Mobx-state tree extensively, and it surprised me that they are not more popular than they are today.

Why Mobx-state-tree?

MobX-state-tree is an opinionated state management framework based on MobX. Actually, this may be the most opinionated of all the alternatives, which is not necessarily bad.

#javascript #web-development #mobx #react #developer

React and MobX-state-tree
2.25 GEEK