I Always Seem to Need Redux
I’m currently building a simple application and I want to try not to use Redux, even though my usage of Redux is a conscious choice and a result of previous frustrations with “vanilla” React. I’m following Ryan Florence and Michael Jackson and their tweets convinced me to try to figure out React better before reaching for tools like Redux. While building my app I read this article, I re-read the whole React docs in case I missed something, I read a couple of other articles which claim that you often don’t need Redux, I even scrolled through this Twitter search to try to collect advice from Ryan and Michael about managing state in React without Redux.
However, I can’t get past very obvious issues of separation of concerns. Redux lets me separate states very clearly, but in vanilla React I have to cram most of my state and functionality in the root component. As for passing props through multiple levels, there are tricks like this, but it still doesn’t help when a state change has to affect completely separate components. Sure, there is context, but callbacks still may have to be passed through multiple levels. Even if we solved all of that, testing that sounds hard, with Redux it’s a breeze.
I would like to see an example of a mildly complex application in React, without Redux/MobX/etc. I just want to see how it can work, because I always seem to need something like Redux for connecting components to the state as needed, React simply isn’t enough, for the reasons you outlined in the article.