Like many devs, I imagine my first response to React was dismissal.
- I'll never tire of jQuery
- I'll totally get to bed early tonight.
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.
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?
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."
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.
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.