Why every good front-end developer shoul ...

Why every good front-end developer should know React, but never use it

Jan 05, 2024

React has its place, after all Next.js has emerged as a leading modern front-end framework for enterprise applications, known for its innovative approach to server-side rendering and static site generation. I know, there were others before it, but they just wasn't quite like React and Next.js. However, using React and Next.js over the last few years, I've grown to hate it.

Why the hate for React, you ask?

Well, it's pretty straightforward. I'm the kind of developer who likes to get things done without a fuss, and with React it makes me write way too much code. Sounds weird, I know, but in our world, time is definitely money. Let me show you what I mean with some code examples.

This is how React does things:

import React, { useState } from 'react';

function IncrementButton() {

// State to keep track of the current count

const [count, setCount] = useState(0);

// Function to handle the click event and increment the count

const handleClick = () => {

setCount(prevCount => prevCount + 1);

};

return (

<div>

<p>Count: {count}</p>

<button ={handleClick}>Increment</button>

</div>

);

}

export default IncrementButton;

Now let's look at how Svelte does it:

// Declare a reactive variable

let count = 0;

// Function to increment the count

function handleClick() {

count += 1;

}

<!-- HTML structure -->

<div>

<p>Count: {count}</p>

<button on:click={handleClick}>Increment</button>

</div>

React's got its perks, no doubt, but when you dive into the nitty-gritty, it's a bit of a double-edged sword. It's powerful, sure, but it also makes you write a ton of code for things that should be simple. You've got state declarations, returns, hooks – the works. In a small project, you might not feel the pinch, but let's talk enterprise-level apps. That's where you see the difference.

Those extra lines in React? They start stacking up fast. What starts as a neat little codebase can quickly turn into a tangled mess, especially when the project scales up. It's not just about writing code; it's about keeping it readable and manageable. That's where React can be a bit of a headache. It's like packing for a weekend trip but ending up with enough stuff for a month. You've got power, but at the cost of simplicity and ease of maintenance.

So, you're probably wondering why you should bother with React if I'm not its biggest fan, right? Why spend time on something I don't think is all that great? Well, I've got a couple of reasons.

First up, React is like the golden ticket for job opportunities right now. It blew up big time, and tech companies, they just can't get enough of it. They often jump on the latest trend without digging too deep. And with loads of big companies and government agencies modernizing their systems, React's become the go-to choice. We're talking about places that used to be all about those giant, do-it-all applications. Their top devs and architects? They’ve been juggling everything under the sun and might only have dabbled in something like Angular for their web stuff.

Now, these folks aren't exactly whizzes with the latest JavaScript tech. So when they start breaking up those massive apps and need a shiny new frontend, what do they do? They do a quick online search, like anyone would. And what pops up when you look up 'best modern frontend JavaScript framework'? Bingo - React, right at the top.

That's good news for you though, right? Now these companies want to hire React experts to get their projects rolling and you just finished a bootcamp course on it because some guy named "coffeebean" told you that's where the money is at.

The second reason I reckon you should get cozy with React, even if I'm not its number one fan, is pretty straightforward from a hiring perspective. See, as someone who's been in the shoes of a Software Engineer Manager, I always keep an eye out for React experience when I'm looking to bring a front-end JavaScript developer on board. It's not just about knowing React; it's about having wrestled with its quirks in the big leagues – think enterprise-level applications.

Why does this matter? Well, React has this way of making you write more code than you might think necessary. To handle this gracefully, you've got to get smart about breaking down your work into as many bite-sized components as possible. This isn't just busywork. It's about mastering the art of organization and modular design. In the world of component-based libraries, this skill is pure gold.

Think about it like this: Working with React is like being a chef in a super busy kitchen. You've got to keep all your ingredients (code) and recipes (components) perfectly organized. If you can do this in the high-pressure environment that React often creates, you're proving you've got some serious chops. It shows you're not just a coder; you're a thinker, a planner, and someone who can keep their cool when the heat is on. That's the kind of developer teams want and need, especially in larger projects where complexity is the name of the game.

So, even if React can be a handful, getting to grips with it teaches you more than just coding. It's about developing a mindset that's all about efficiency and scalability. It turns you into the kind of developer who doesn’t just write code but thinks about the best way to structure it for the long haul. That's why, in my book, React experience on a resume is a big plus. It tells me this person has been through the wringer and came out sharper for it

Vous aimez cette publication ?

Achetez un café à coffeebean.dev

Plus de coffeebean.dev