You may have seen the use of one or both of these functions listed near the end of a component in a Redux app. What exactly are they doing there? Their names are quite descriptive, yet somehow don’t convey exactly what it is they DO. Let’s unravel their path through an app.
When I started building my first application with React using Redux, I had learned the basics of React and thought I understood the pretty basic concept of different types of components. Some components are basically functions, some are classes, more similar to a Ruby class, and some are containers that hold and render other components. Great, easy, moving on.
After building a working application with Rails alone, I started out by wondering what JavaScript had to offer that I couldn’t accomplish already. While JS isn’t required to make a webpage, it sure does offer some fun options. Being able to make asynchronous requests ( HTTP requests to the server ) at the point in your code that it’s needed speeds up your application as well. JavaScript’s lack of convention in modeling files is a bit of a double-edged sword; on one hand it leaves you pretty open to build your application in a way that makes sense to your project, but on the other it doesn’t stop you from creating jumbled code either.
Oh man, ActiveRecord associations, am I right?
# Here we are again at the end of another project. I’ve come a lot farther and still feel the struggle as much as when I was just two months into this. But that’s ok, I’ve come to think of this journey like going to the gym - each time you go to the gym, you get a little stronger. So each time you go, you increase the intensity or the weight of your workout. It should never be easy or you’re doing it wrong. So it is with coding - there’s so much to learn that it should always be somewhat of a challenge. It’s constant improvement, always learning more and adding to what you know. It’s not easy, but you’re getting consistently stronger at it. Effort in my mental workout is just as important, and just as rewarding, as my physical workout.