On Mastery of the Fundamentals (Part 1/n)
Tags: launchschool, capstone, fundamentals
Published: 2022-07-23 21:06:25

---
title: On Mastery of the Fundamentals (Part 1/n)
published: true
description: 
tags: LaunchSchool, Capstone, Fundamentals
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34vkiuy1v12spl0u43r3.jpg
# Use a ratio of 100:42 for best results.
---
As a part of our [Capstone preparation](https://launchschool.com/capstone) we are working our way through part of the excellent [Full Stack Open](https://fullstackopen.com) course, much of which has centered on React.  LaunchSchool's Core program is explicit about focusing on JavaScript fundamentals instead of frameworks out of the gate, and my experience of learning React has really demonstrated the wisdom in that approach.

## Comfort with the underlying JavaScript

Going through this course I am regularly pleased with how easy it is to pick up the React functionality and not get tripped on on the JavaScript.  Consider the following common line:

```js
const [username, setUsername] = useState('')
```
In this one line are ideas that spanned many different fundamental JavaScript lessons, not limited to (and in no particular order):
1. Array destructuring is a handy way to return multiple values from a function (and superior to object destructuring in this case)
1. `useState` must be a function based on how it is used - but what exactly the `''` argument is doing requires consulting the docs
1. `setUserName` is now a function to be invoked or passed around as we need
1. ... (omitted for brevity)

Imagine if this was the first time you had seen array destructuring or higher-order functions - it would take much longer to parse this one line.  And we wouldn't even have touched on the scope of these variables and how to pass them to components defined in other files...

## An understanding of the problems React solves

Caveat, as a new developer I'm sure I only have a surface level understanding of the problems that React solves, but even so I see some big ones.  In our study of JavaScript fundamentals we covered the DOM manipulation APIs made available to us by the browser.  We did things like:

```js
let header = document.querySelector('body>header');
let title = document.querySelector('h1');

header.insertAdjacentElement('afterBegin', title);
document.body.insertAdjacentElement('afterBegin', header);
```

And don't get me started on toggling the visibility of elements.  Understanding the pain of manipulating the DOM manually illuminates how much simpler using React to build applications is.  And I haven't even gotten to complex applications yet - I imagine the benefits scale with application size.

## Targeting points of confusion

Having a strong mastery of the fundamentals has also been helpful when encountering entirely new syntax. Consider the following return from a React functional component:

```js
return (
      <div>
        <h2>Log in to application</h2>
        <form onSubmit={handleLogin}>
          <div>...
      //...continued
```

If I had an unsteady grasp on JavaScript I might think you can just write HTML in a .js file.  But I knew better - there is something different going on here, because that is not the way you create and manipulate HTML elements in JavaScripts.  From here it was easy to locate what is actually going on (in this case, JSX).

And here is the rub - because of my comfort with basic JS and HTML writing JSX is super-easy to pick-up!  One's mastery can be built upon.

## Conclusion

I have no regrets of the time I spent on mastery of the fundamentals of JavaScript, and will definitely take this viewpoint with me as I move further into my career.

---
Cover Photo by <a href="https://unsplash.com/@jakobustrop?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Jakob Braun</a> on <a href="https://unsplash.com/s/photos/brick-wall?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>