React is a JavaScript library that simplifies the process of creating an app’s user interface. React is centered around the use of components, which accept data as props and return JSX elements. JSX is basically a JavaScript syntax that looks like real HTML. Elements written in JSX must be compiled by Babel before they can be rendered on the DOM. Don’t let that intimidate you. The beauty of React is that it allows us to break up our code into many reusable pieces (a.k.a. components), which can help tremendously with debugging.
I may be far beyond my trick-or-treating days, but in the spirit of fall, I am throwing it back to the Halloween nights I spent tallying up my pillowcase of candy and negotiating swaps with my sister. Much to our dismay, my mom would make us combine our candy stashes to “save space” in the pantry. I’m going to demonstrate how the Set object works by using it to combine my sister and I’s lists of candy into a single list with no duplicates.
“That’s so fetch!” Although Gretchen Wieners probably wouldn’t understand, this is what I found myself thinking as I learned how to use JavaScript and the fetch() method to communicate with a Rails API. (Sorry, I couldn’t help myself.)
As I built my first Rails project with multiple models and “many-to-many” relationships, I became best friends with the ActiveRecord Associations Class Methods documentation. There were a few situations where I knew I set up the associations correctly, but I was still getting errors like, “Did you mean #users_trips
, not #users_trip
?” I needed a better understanding of the methods my objects and classes had access to through their ActiveRecord associations. I quickly learned that #build
just doesn’t work for everything, so I dug into the docs to figure out why and what other method I could use instead.
Upon completion of my first MVC Sinatra app, I decided to step out of the weeds and climb a hill to take a look at my project from a different vantage point. I spent so much time worrying about the details of my app that I wanted to review the high-level concepts I used to build it before moving on with the curriculum.