How I learned to stop worrying and love Redux
There are a ton of tutorial posts about how to use Redux out there, and instead of creating another tutorial post to add to the noise, I thought I’d share some more basic things I’ve learned through this process.
- The first thing I did was build my React application without Redux. I was aware of Redux, and knew of it’s usefulness, but I knew I didn’t need it when I first started. Every app is different of course, and if you’re building complex application with lots of views that share data, then it’s wise to use some sort of state management from the get-go, whether that’s Redux or something else. For my purposes, my application was simple enough that I didn’t need Redux in the beginning. If you’re just starting out learning about React, I would recommend learning that first and moving on to Redux when you feel confident enough with React. React has features that make it a little different from other types of programming, especially if you’re coming from the land of JQuery. Adding on another library to use/learn can be overwhelming. I should also mention as a side note, that Redux doesn’t have to be used with React exclusively, it can be used in any framework of your choice, but I think the above principles still apply no matter what tools you’re using to build your application.
- Watch Dan’s tutorials — The video tutorials were the most helpful part of this whole learning process for me. He explains each step of the process thoroughly and I learned a ton. He just recently released a new set of videos that explain some concepts that people have a hard time understanding. I haven’t watched all of them yet, but the ones I have watched have also been very helpful.
- Read the docs — I think this is a given with any library/language/uhh life in general? I’m pretty sure I read them at least 10 times.
- Still confused? Read the docs one more time. Seriously.
- Still confused? Find a good book/tutorial/example that can help you get started. Sometimes it helps to find someone who has explained things slightly differently. Here’s a list of a few good resources:
- Fullstack React Book
- The Complete Redux Book (still a work in progress, but has sample chapters available)
- Redux Without Profanity
(credit to acemark for the suggestions on this list!)
6. Ask questions! I wrote a blog post with some of my questions, hoping one or two React/Redux developers out in the interwebs would see it and could help me out. I ended up getting way more help then I ever anticipated and it was really motivating to get help and encouragement from so many developers. I’ve actively sought help on Twitter with a lot of success and although I’ve only lurked on Reactiflux there are plenty of developers on there willing to help with questions. I had a few generous developers lend me an hour of their time to Skype with me and go over some of the issues I was having with integrating Redux into my application (kudos to Ryan Irilli and Dan Abramov — you guys are awesome).
7. Dispatch all the things.
The biggest advice I give anyone who gets stuck is “stop overthinking it. Just dispatch more actions”. That’s usually the answer to most problems. — Francois Ward
This was one of the most helpful comments I received. I really took this to heart — I mean check out this beautiful masterpiece of an action creator I have right here:
Ok, maybe I went a little overboard with dispatching all the things. I don’t care really — it makes sense to me and for my app!
8. Finally, don’t give up! I echo the sentiment expressed in this article:
Great developments never come from within your comfort zone
I’m so glad I stuck it out and didn’t give up on Redux — I think it’s really clicking for me now and I hope it does for you too! I’m off to go watch the rest of Dan’s videos!