3 min read

That Facebook Thing

That Facebook Thing

So this is React.

I mean - this is it. It's really weird to describe how I felt about starting this - we finished our projects, I had some personal stuff to deal with - and suddenly: React.

To back up a little.

When I was sick the last time (with a kid, that doesn't happen too rarely) I was laying on the couch watching the React documentary. I that was the first time I kind of got an inkling of what React was, or what it did. Before that I only knew of it - like when developers tweeted stuff like "React hooks are dead" or "Create React App is dead" and those things that people always tweet about.

I had listened to Syntax FM for about a year now, and the two hosts are both JavaScript React developers (sure, one of them uses Svelte and Sveltekit, but you know) - and so that meant like a big deal, even though it - still didn't mean anything to me. I had listened to their The React Episode before and understood - zero. Absolutely nothing. The vocabulary of "components" and "props.children" and "life cycle methods" had nothing to do with the JavaScript I was writing - until last week.

The framework/library/both/neither has landed!

Since the aim of this bootcamp I'm in is to teach us to be Full Stack Developers in the MERN stack, we of course had to learn the R - and now was the time to do that.

I was also great timing - by chance, I would assume - cause mid-March the new React docs were published - and they're basically a tutorial/wiki by themselves!

Obivously, the most weird thing to get used to in React is probably the mix of HTML and JavaScript in one file. That's also one of the loudest arguments brought against React when it was first announced - the separation of concerns is out the window, and that is by design. Who would want that?

To be honest - I want that. Like, nothing against having nice and tidy code. I like that too - you have your HTML code here, and you TypeScript there, and it makes sense and you don't have to worry about it. But another valid perspective that React allows for is: "where the hell is the code that does in my HTML - where is the eventlistener?" or something along those lines. With React, all the things are there, contained in one unit - in one component. Brilliant idea, or abomination - I guess it depends on who you ask.

But that is how I learned - or am learning, of course - React. The whole framework is vast, so the class material had to make some choices that would make our next projects work; so we concentrated on creating specific components and making them work together, looked and specific hooks like the useState, useEffect or useContext, and how to use React Router to connect to the backend. Now, to use those technologies might sometimes come across as outdated - like using Create React App. But knowing these things will be helpful; be it with working on legacy code or just to understand the history of how things on the web were created - at least I find that very helpful.

The Road

Another very helpful resource outside the class code with tons of exercises was Robin Wieruch's Road to React - in the newest, updated version of 2023 an absolute must-read (if you want) for anyone who wants to know about React. Setting up projects using Vite is just one of those essentials to pick up here - and it's not just the book, it's the sheer amount of blog material Robin Wieruch has published and is using in the book as well. Definitely a recommendation for anyone who is new to React and wants to pick it up quickly.

Me personally, I'm still very excited just looking at React code. It can of course get a bit confusing with lifting the state and keeping in mind where goes what and for what purpose - but overall, the reusability of everything in your codebase? That is just awesome. Really Looking forward to building our last project with React.