Thoughts on Application State

Mat Warger Articles, AWS, JavaScript, React 1 Comment

Use Redux! Use MobX! Just use `setState`!
Redux is functional! Mobx is reactive! `setState` is built-in!
But Redux has so much boilerplate! But MobX is more difficult to debug! But `setState` doesnโ€™t scale!
Why donโ€™t you just use Rematch to abstract the Redux boilerplate? Do I use redux-thunk? redux-saga? redux-observable?
How about using Unstated? How about just using the Context API?

:head-explodes:

There are a lot of options for developers regarding how and when to use state management libraries (SML).

Remember those last two articles (The Joy of Forms with React and Formik &ย One Router to Rule Them All: React Router) about the massively underplayed game library? There was a third part to comeโ€Šโ€”โ€Ša follow-up meant to implement an example of state management for an application. The application was small, granted, but this somewhat contrived example would tie it all up. Itโ€™d be the cherry on top. It would complete the rule of threes.ย ๐Ÿ˜‰

There is not going to be another tutorial about which state library we can use to better manage our game library. Rather, in this post, weโ€™re going to look at how and why you might use a library to manage your applicationโ€™s state, and why that particular application is a perfect example of when you might not need a SML at all.