DEV Community

Cover image for React is the Treasure I Found Among The Goats
Max Antonucci
Max Antonucci

Posted on • Updated on

React is the Treasure I Found Among The Goats

Like many devs, I imagine my first response to React was dismissal.

  • It's just another JavaScript trend that'll fade out fast
  • Writing HTML in the JavaScript is asinine
  • I'll never tire of jQuery
  • I'll totally get to bed early tonight.

Turns out I was wrong on all counts, and began changing my mind after doing actual research. One recent article in particular gave some surprising statistics. React growth has outpaced other JavaScript frameworks, and at this rate will overtake Angular usage. It's won in user satisfaction, including against Vue. React beat jQuery in indeed.com job listing popularity, its first loss in over a decade.

So I swallowed my pride, donned my learning cap, and dug into React. I read through the docs, read articles breaking down the pros and cons, and did some tutorials. But my final test was my JavaScript rite of passage - using it to recreate the famous Monty Hall Dilemma. I did the same when learning jQuery, Angular, and Vue. Now it was React's turn.

The result? React passed with flying colors, and broke through my last layers of cynicism. Check out the final result and the code repo.

This post actually isn't about how I coded this app - I don't think there's enough interesting tricks to justify a full post. Instead, it's about how my opinion of React changed as I made it.

Wait, Why the Monty Hall Dilemma?

If you haven't heard of it before, the Monty Hall Dilemma (MHD) is a well-known little logic puzzle. You're given three doors, one with treasure and two with goats. You select one door, but before that door is revealed, the host opens a different door that has a goat. You now have a choice: stick with the unopened door you chose, or switch to the other unopened door. Statistically, you double your chances to win by switching.

I've found the MHD hits the sweet spot for learning a tool or framework. It's simple enough for a relative beginner to handle, but complex enough to solve creatively and overcome common issues in serious projects. Most importantly, by the end I know if I'm comfortable with the new tool or not.

Lastly, it allows me to make intriguing, click-baity blog post titles like the one here. Isn't that what matters most in the end?

Why did React do so Well?

This is a tough question to answer, since my reasons for liking React cover a wide spectrum. Most have already been discussed in any number of React articles:

  • React components and their styles are extremely modular, which fits well with my preferences for object-oriented coding and atomic design.
  • React's virtual rendering engine lets it be used beyond the web, such as for mobile apps and virtual reality.
  • The above virtual rendering engine, combined with one-way data-binding and conditional rendering, makes React very fast. Who doesn't love fast apps?
  • CSS Modules. Enough said.

But the main reason I'm liking React will seem counter-intuitive: there's no "framework magic."

With React, You Need the Fundamentals

You may wonder why "needing more work" is a plus. Frameworks I've used, like Ember and Rails, do lots of work for devs with the "convention over configuration" mindset. I'm not against this, especially for more experienced developers who need to start and scale an app fast - it saves times and gets things going. React also has "Create React App" that makes a basic, preconfigured React project, so it's not above this either.

But at its core, React is a library, not a framework - it doesn't have that magic. Even with Create React App, I couldn't ignore basic JavaScript - functions, ES6, scope, closure, imports and exports, destructuring, etc. I can't ignore how the app works, how it's structured, or where the data comes from. I'll also only write better React by writing better JavaScript as a whole, which is ultimately what I want.

This matters to me, since using a tool based on better fundamentals helps me learn as a junior dev and keeps away Imposter Syndrome. React doesn't demand understanding much about the library itself, but it does demand a strong knowledge of JavaScript. This greater learning curve for beginners is why I've put off React for so long, but I think I misunderstood it. That curve comes from more learning the language, not the library. That's a curve I'm all the more eager to get over, and I'll take every incentive I can to beat it.

React will be great to play with as I build this foundational knowledge. It may be limited to side projects for several years, but even so, I'll keep using it. I already have several ideas, including using Gatsby.js to remake my personal site for the May 1st Reboot challenge.

Normally I don't learn this much from a game about looking for treasure among the goats. Never would've guessed the "treasure" here was a new favorite JavaScript library!

Top comments (12)

Collapse
 
jaimemateo profile image
Jaime Mateo

I started coding web and learning JS in an AngulaJS project. Now, moving to React made me learn more JS basics than Angular did. As a beginner I'd rather prefer now to learn frontend with React better than others...

Collapse
 
maxwell_dev profile image
Max Antonucci

I 100% agree there. It's the main reason I prefer learning with React, I'd rather learn the basics of the language instead of the specific framework. It brings much better long-term benefits with our career and what we learn.

Collapse
 
alejandronanez profile image
Alejandro Ñáñez Ortiz

Thanks for sharing Max. I agree with you, even though I have quite some experience with web development, in general, I think React makes you learn Javascript easily than Angular for example, the less magic, the better :)

Keep posting!

Collapse
 
sangeethks profile image
Sangeeth KS

So, what you are trying to say is React is way better than Vue.js ?

Collapse
 
wladston profile image
Wladston Filho

The question I'm left with is, for a new project you are starting from scratch, disregarding the gains of learning something new (which could skew the response towards React), would the author pick Vue or React?

Collapse
 
dgubert profile image
Douglas Gubert

I think he's only trying to say that he likes React better :)

Collapse
 
maxwell_dev profile image
Max Antonucci

This would be correct :)

Collapse
 
sangeethks profile image
Sangeeth KS

Yup... that's correct. As a Vue.js developer, I dont think one framework is better than other. Each one of it has its own cons and pros. Full support for vue <3

Collapse
 
gash profile image
Gash

Well, I think it is.

Collapse
 
oneted11 profile image
one ted

After touch and go learning with multiple js frameworks i decided to focus on react because i read an article that it relied more on the language itself than magic, this led me down this rabbit hole of learning what the hell "this" actually meant to scopes and js functions and data manipulation, I have found myself running to pure js books and articles more than React focused ones and I thin It has made me a better programmer,there's still a lot i haven't yet understood but as I keep trying to make my daydreams into code the more i hit brain-mushing errors and learn something new

Collapse
 
renannobile profile image
Renan Lourençoni Nobile

I've started learning React a few weeks ago but haven't had time to really start a project. I might try the Monty Hall Problem though, seems like an interesting and simple page to build.

I come from a Angular background, been working with it for over an year now. I'll admit that at first, React seemed more difficult than Angular, because before that, I used to work with C# and MVC, so it was more like that.

What made me want to learn React was that same article and the increasing amount of job offerings I have seen related to React/Native and Node.js.

Collapse
 
maxwell_dev profile image
Max Antonucci

The increased focus on it, both from developers and job listings, is also what got me interested at first too. It's definitely a change in thinking moving from frameworks like Angular to React, since you need to think in a much more modular. I recommend the below article from the main React site, it helped me a lot:

reactjs.org/docs/thinking-in-react...