React tutorial: Get started with the React.js JavaScript library

Learn the key concepts behind React and how to use JSX elements and components to build lean and fast web front ends

React, also known as ReactJS, is an open source JavaScript library for building user interfaces, often for single-page applications or to add interactive views to existing web applications built in a variety of architectures. The React project originated at Facebook; the open source project has a BSD license and a patent rights grant from Facebook.

React is not an end-to-end JavaScript application framework. It has no support for models or controllers, although there are projects related to React that cover these functions, along with routing. You can easily combine React with other architectures.

Why React?

One of the top reasons people cite as a reason to use React is actually controversial: JSX allows you to mix JavaScript and HTML in a single component, which is transformed into pure JavaScript as part of the build step. At first hearing, that sounds like a terrible idea because it violates the principle of separation of concerns.

React fans respond by pointing out, reasonably, that UI presentation and UI interaction are closely linked concerns that don’t really need to be separated, and that in practice JSX makes writing user interfaces simpler. They go on to add that purists can write React completely in JavaScript if they want; it just takes more code and isn’t as easy to write or read.