Why I Got Into React

By Dave Ceddia Comment

Back in 2014 (ye olden times) I got my first front end job. Up until then, I was mostly a back end developer.

And when I say back end, I really mean C and C++. Pretty much the polar opposite of web development. It was a totally different world, with hardware and oscilloscopes and memory management and segfaults. (Lots of segfaults.)

So those first few weeks at the new job were intimidating, to say the least. I’d been hired onto a team to build a brand new app with AngularJS (a.k.a Angular 1.x, but we called it Angular, because there was just the one).

Myself and the other front end dev were both new to Angular, but he’d already been at it for a few months, and I was a total noob. I remember scrambling to get through a few tutorials before my first day, so I’d at least have a hint of a clue of what was going on.

Controllers, directives, factories, services, dependency injection, two-way binding… it kinda felt like they’d made it hard on purpose. But we figured it out as we went.

We worked on this app for a couple years – long enough that the Angular code started to grow moss. Our internal “best practices” had changed so many times as we discovered new ways of doing things that navigating the codebase was like an archeological expedition.

I just imagine a tour guide walking through that codebase in the year 2020, flashlight in hand, explaining the back story…

“If you look to the left, you’ll see the Service vs. Factory era, where the developers couldn’t make up their minds about whether to use factories or services. Angular didn’t provide any clear direction on that in the early days.”

“And as we pass by the Towers of Crufty Tests, take note of the quaint dependency injection techniques they used, and all the boilerplate! Back then, JavaScript didn’t have imports and Angular had its own module system where you had to register every module by hand.”

Aside from becoming a bit of a weedy mess, the app had also started to get sloooowwwww. You’d click a button and it would just freeze for half a second. Then we had this fancy workflow builder with a bunch of nested elements – the main feature of the product – and as the layouts got bigger it got slower, and sloooower, and slooowwwwweerrrr.

About that time I had started hearing about this new React thing. It mixed HTML and JavaScript, which seemed sacrilege to my Angular eyes (“but, separation of concerns!!”). But everyone kept saying how FAST it was. So I bit the bullet and gave it a try.

You know that scene in movies where the character has an epiphany, and a light turns on, and there’s a choir singing somehow?

Trying React was like that. It was a breath of fresh air, being able to write slim lightweight components that did a single thing. The idea of expressing UI as a function of state made a ton of sense. When the values are like THIS, the UI should look like THAT. The idea of “components” just felt right.

So it was time for a field test. I found a library, ng-react, that would let me put React components inside our Angular app. I rewrote our sluggish fancy workflow builder into a React app. And WOW it was faster. Everything was instantaneous again. And it was less code, to boot.

I was a convert.

By that time I had started writing a blog, and most of my articles were about AngularJS. Angular 2 (now… 8?) was on the horizon, and I had been trying out the alpha builds, but I wasn’t really sold on it.

The tipping point happened when I published an article called Why React, Why Not Angular 2? It struck a nerve, and all of the positive comments from people who felt the same clarified my decision to switch to React.

From then on I wrote mainly about React, and in 2016 I wrote my first book, Pure React. I’d had so much fun building things with just React by itself that I wanted to teach others how to do the same – learning React on its own without having to figure out Webpack and Redux and all this other stuff at the same time. I wanted to share the feeling that React was light and fun and freeing.

I got into React because it was enjoyable to write. I’m still here because, well, it’s still enjoyable to write… but also, because React has grown to become the de facto standard choice for most apps.

There’s a ton of opportunity related to React, and I don’t see that disappearing any time soon. Even with other exciting frameworks like Vue and Svelte, I think React has achieved the sort of widespread adoption to where it’ll be around for quite a while.

What got you into React? Leave a comment!

Learning React can be a struggle — so many libraries and tools!
My advice? Ignore all of them :)
For a step-by-step approach, check out my Pure React workshop.

Pure React plant

Learn to think in React

  • 90+ screencast lessons
  • Full transcripts and closed captions
  • All the code from the lessons
  • Developer interviews
Start learning Pure React now

Dave Ceddia’s Pure React is a work of enormous clarity and depth. Hats off. I'm a React trainer in London and would thoroughly recommend this to all front end devs wanting to upskill or consolidate.

Alan Lavender
Alan Lavender
@lavenderlens
comments powered by Disqus