Codementor Events

So you want to learn React.js?

Published Nov 09, 2017Last updated May 07, 2018
So you want to learn React.js?

First, make peace with the fact that you need to learn more than just React to work with React. This is a good thing, React is a library that does one thing really well, but it is not the answer to everything.

However, identify whether what you are currently learning is React or not, mainly so that you don’t get confused about your effort to learn React itself. A programmer who is comfortable with HTML and one other programming language will be able to pick 100% of React in 1 day or less. A beginner programmer should be good enough with React in a about a week. This is not counting the tools and other libraries that complete React like for example, Redux or Relay.

There is an important question about the order with which you need to learn things. This order would vary based on what skills you have. It goes without saying that you need a solid understanding of JavaScript itself first, and of course, HTML as well. I like to be specific about this here, so if you don’t know how to map or reduce an array, or if you don’t understand the concept of closures and callbacks, or if seeing “this” in JavaScript code confuses you, you are not ready for React and you still have a lot to do in JavaScript land.

Refreshing your knowledge on JavaScript first would not hurt, specially because you need to learn ES2015, not because React depends on it (it does not), but because it is a much better language, and most of the examples, courses, and tutorials you will find use the modern JavaScript syntax. Specifically, you need to learn the following:

  • The new features of the object literal
  • Template strings
  • Block scopes and the use of let and const
  • Arrow functions
  • Destructuring, arguments defaults, rest and spread operators
  • Classes and inheritance (used slightly in defining component, but to be avoided otherwise)
  • Class field syntax to define methods with arrow functions (Stage 3 feature)
  • Promise objects and and how to use them with async/await
  • Importing and exporting modules

You don’t have to start with ES2015, but you do need to eventually learn it (and not because you are learning React).

So other than ES2015 stuff, you need to learn the following to be a productive React developer.

  • The APIs of React, ReactDOM, ReactDOMServer: These are not big APIs really, we are talking about maybe 25 different things and you would rarely use them all. The official React documentation is actually a very good starting point (it has gotten a lot better recently), but if it still confuses you, watch an online course, read a book, or join a focused workshop. Your options are endless here, but be careful what you pick and make sure it has a focus on React itself and not its tools and ecosystem.

  • node and npm: the reason you need to learn those (for React), is because there are a ton of tools that are hosted at npmjs.org that would make your life easy. Also, since Node allows you to execute JavaScript on your servers, you can re-use your front-end React code on the server (Isomorphic/Universal applications). Mostly, what you will find valuable with node and npm is working with module bundlers like webpack. This is much more important when you are writing a big application, but you will need at least one tool to work with JSX (ignore the advice that JSX is optional.) Learn JSX and use it. The recommended tool is Babel.js

  • React ecosystem libraries: Since React is just the UI language, you will need tools to complete the picture and go beyond even MVC. Don’t start here until you are very comfortable with React itself. I will give you two things to focus on, just forget everything else you encounter and learn these two first once you are done with React itself: react-router and redux.

  • Right after getting comfortable with the raw concepts of React itself, build a React Native app. You will only truly appreciate the beauty of React once you do that. Trust me.

During your learning process, the best thing you can possibly do is build stuff with your own hands. don’t copy paste examples, don’t follow instructions blindly, but rather, mirror the instructions to build something else (ideally, something you care more about). Whatever you do, just do not build a TODOs app.

I find building simple games to demonstrate the ideas of React much better than starting with data-driven serious web applications. That is why in my Getting started with React.js course, I focus on building a simple game. I’ve also built a different game in this article . Try to implement other similar games in a JavaScript playground like that, it is a good start, you don’t need a server, and you don’t need to manage a crazy state.


I am writing a React.js e-book that will be published soon. You can pre-order it here.

Learning React by Building Games | eBook

I create online courses for Pluralsight and Lynda. My most recent courses are Advanced React.js, Advanced Node.js, and Learning Full-stack JavaScript. I also do training for teams covering beginner to advanced levels in JavaScript, Node.js, React.js, GraphQL, PostgreSQL and more. Email kyle@agilelabs.com if you want to book a training for your team.

This article was originally published here

Discover and read more posts from Samer Buna
get started
post comments4Replies
Arun
7 years ago

Thanks for the given me amazing post you have to forever laik the best function in tot he window 10 get the link here http://remotedesktopwindows10.com and access in to the file explorer so save your file forever.

Jae Duk Seo
7 years ago

Thank you for the post!

Anna R Grow
7 years ago

Thanks for putting this together, gave me a great idea on how to expand an already budding idea? One of the best posts I have read. I loved it. Thanks for sharing with us.
https://www.triumphessays.com

Show more replies