Nice way to describe this.
Justin Jackson
11
Love the feedback and suggestions! To address your points, here are some of my thoughts:
- I completely agree with you that I’d rather future proof my codebase and use technologies that might help make my application scale better. But to be honest, I find that just using a technology without knowing how it actually helps your codebase is not the best approach. In this particular case, our team wanted to introduce React into an Angular 1.x application and we wanted to minimize as many new technologies at once. I had read about Redux but honestly didn’t really see it fit into the picture yet so I had suggested to my team that we leave it out until it made more sense. I think this was the right decision because it led us to seeing some of the pain points of just using React and including all of our business logic inside our view layer. From those pain points, we were able to then see the value of an architecture like Flux (Redux in this case).
- I used to think that introducing Redux into a full blown React application would be tough, but to be honest, in my experience it’s actually been pretty seamless. The reason its been pretty pleasant for me is because I don’t immediately try to move everything out of the component state and into the redux application state. Instead, I first introduced redux via a new feature that we were working on. For this particular component, instead of declaring the state in the component itself, I just moved it to the redux state. At this point, the redux state is super minimal — but that’s totally fine. Slowly, I started moving the rest of my other component’s state into the redux state.
- I think the other tricky part about using Redux and React is that you actually want to use another library that “glues” these two libraries together, and namely that’s React-Redux (https://github.com/reactjs/react-redux). Luckily the API is super small and it’s pretty easy to use — I actually have plans to write another post which dives into this a little bit more so stay tuned! I think this will actually help address the suggestions you made about Smart and Dumb components as well as how to wire up Redux and React to work together.
Hopefully the post was still helpful for you and really appreciate the great suggestions!