Lambda School - Week 9: Redux That!

“I’m not a great programmer, I’m just a good programmer with great habits.”

— Kent Beck

Week 9 of Lambda School was all about Redux. And boy was it a tough one! Somehow, someway, we managed to survive.

For those not in the know, I’m a student at Lambda School’s Full-Stack Web Development program (Read more here). In short, Lambda School offers 9-month programs in web development, data science, and iOS development that are free until you get a job. If you don’t get a job, they don’t get paid.

As usual, I've done a write-up of my experiences, the ups and downs, shenanigans, and curriculum this week. If you’re not yet caught up on my weekly recaps, I recommend you start here.

All Aboard The Struggle Bus

We've come a long way. Two months ago, we got our first taste of what life at Lambda was like. Back then, we quickly got acquainted with the basics of HTML and CSS. Ahh the good old days. Now, we're onto advanced state management. Did I mention the pace is pretty damn hectic?

Suppose you're building a website or app and you want to keep track of some data. Someone's account info, if they've clicked a particular button, if they're premium members or not, so on and so forth. In essence, you want to keep track of the ‘state’ within your application or website. With React, this is normally done locally in every single component. Each element keeps track of the info that's relevant to itself. Occasionally, we will have to pass on this info to lower components (which we call props passing).

Now, what do you think would happen if you're building something on the scale of Facebook? It would get pretty dull having to manually pass this info to every single component, right? You'd end up with spaghetti-code like no other. What if a component has to talk to another one, way further down the line? Obviously, there has to be a better way to do things. Redux is just that.

With Redux, you can have one overarching state (also called a ‘store’) which is then accessible anywhere you want. Whether your app consists of 5 parts or 5,000, it's all the same to Redux. Redux allows you to create data structures that are accessible and editable from anywhere in the application.

Redux would thoroughly kick my ass, I just didn't know it yet.

To set-up Redux, you have to run through a couple of steps. You essentially have to have to split up your normal React workflow. You declare Reducers (your actual variables), Action creators (global 'shouts’ that are triggered when events occur), and Actions (functions that mutate the Reducer values). It all made my head spin. Were was I supposed to put what, again?

It was a lot to take in at first and the first two days passed by in a blur of unfamiliar terms and a lot of guessing. I knew Redux was a deterministic skill; there was a right way to do it and a wrong way. I just couldn't figure out what the right way was!

Mind you, I had gotten very used to building applications with the more traditional/less scaleable method. I would simply pass down props. It might've been inefficient but it worked just fine.A lot of my struggles stemmed from have to unlearn this approach.

After barely managing to wrap up Tuesday's assignment (by taking more than a cursory glance at the solution), I knew I had to try a different approach. So, come Wednesday morning, I woke up at five o’clock, opened up Training Kit and went to work. I find that I learn best when taking it slow, experimenting a ton and summarizing the info I run across.

In a sense, I'm recreating the Feynman technique. By taking notes as if though I'll be teaching someone else (myself), I have to explain things logically and succinctly.

Four hours later, just before class started for the day, I finally got Redux.

Another Day, Another Framework

As always, here's a small recap of what we covered this week. It's staggering to see how much we've covered thus far over the past two months. At the end of Lambda, I might put everything together into one enormous list.

This week, we covered:

  • Redux (duh!);
  • Reducers, Actions & Action Creators;
  • Data immutability;
  • Middlewares;
  • Redux Thunk & Logger;
  • Async requests using Redux;
  • API-Token Authentication;
  • Protected Routing.

I also did the following outside of the curriculum:

  • I spent an hour or two playing around ReactStrap, an alternative way of styling React components. Frankly, I didn't really care for it. Using vanilla bootstrap with HTML is so useful because it's instantly clear how the grid-system will affect your content. With React components being self-contained and in separate folders, this is absent; hence reducing its usefulness.
  • I watched the first couple of videos of this Udemy course on React Native and Redux. So far, I'd highly recommend it!
  • Finally, I reviewed Wes Bos’ excellent course on Redux (found here);

Slowly but surely, a vision is starting to form of what skills I want to build before graduating from Lambda. Sure, we'll learn plenty. Hell, we haven't even covered the back-end or CS just yet.

I want to be capable of putting together an MVP of anything and everything I could ever come up with. Whether it's a language-learning app or a SaaS company doesn't matter. I want to be just dangerous enough to put together a public beta and look for funding. For the most part, I think I can already do this. However, when it comes to integration and architecture, I still have quite a bit to learn.

State Of The Lambda Union

Is it just me or are these posts getting shorter?!

This week was by far the most difficult week thus far. I'd never used Redux, so there was no head-start to speak of. I struggled quite a lot. And yet I felt all the better when everything finally clicked. Perhaps it was the universe telling me I shouldn't get cocky. ¯\_(ツ)_/¯

Next week is build week. Normally, every Lambda student gets assigned to a team with members from different programs and cohorts. However, since we're the first (and currently only) EU cohort, there's no such option for us. However, some of the EU students have decided to work with the US-based students, differing timezones be damned.

Next week will be interesting. It'll be cool to see what we can come up with in four days of non-stop activity.

As always, I'll let you know next week.

Sign Up For Friday Favorites!

Join the 500+ people who receive my Friday Favorites newsletter in their inbox every week. It's a mash-up of the most interesting links, books, and ideas I came across that week, as well as my latest articles and book notes. If you're curious and looking for high-quality information, you should definitely join.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.