React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

Back to basics: setState growing in popularity for React state management

State management continues to be a hot topic in the React development circles. After Facebook introduced the Flux pattern, there was a plethora of solutions like Alt, but soon the community largely settled on Redux for state management.

Redux has become the de-facto state management tool for most React developers since it's introduction in 2015. Many have also enjoyed working with MobX for a more reactive approach to state management.

In the recent weeks there has been quite a bit of discussion in the online programming forums about Redux being too heavy weight for many applications. And so it seems that this turn of the tides has lead to many prominent React developers now promoting plain old setState as their preferred state management method for React.

Most notably Ryan Florence of React Router (and ex-Facebook React) team went out on Twitter and stated that in his opinion Flux hampered react innovation:

While this may seem like a trollish tweet at first, it is true that in the last two years of the existance of React (and many other front end libraries and frameworks) have spent a disproportionately amount of time onanating over different state management approaches and philosophy.

This tweet has resonated with others in the React community, with Matt Hamlin of Wayfair chiming in on a refactoring job going way out of the estimates:

In the middle of a really big react re-write at work currently, originally scoped the ticket to three days of work. Its been 6 days so far.

In his effort he is faced with using Redux & Redux-Thunk, which seem overly confusing. Some hours later he had made the decision to move forward with the simpler method of simply using setState and completing the refactoring task in hours, rather than days:

Decided to do it, what would have taken 3 days to complete, finished in about 4 hours this morning. https://t.co/9wqaXy0rPY

This seems to be just one example of where the JavaScript / React community is starting to scale back on adding libraries and abstractions. Seems like it's a back-to-the-basics movement for React state management in 2017.