What is React


The previous lesson described the limitation of Vanilla Javascript applications. It also described a mental model based on reusable components that would make our life simpler.

This lesson introduces React: a javascript library that does exactly that: writing web applications as a set of reusable components.

Members only
20 minutes read

🤔 What is React?

React is not a new language. It's a JavaScript library: a collection of pre-written JavaScript code that you import into your project and use.

Screenshot of the React website front page

Overview of the React homepage

It was created by Facebook in 2013 to solve exactly the problems we saw in the previous lesson: manual DOM syncing and copy-pasted code everywhere.

React is big: 243k stars on its open-source GitHub repo and counting. It's by far the most popular way to build web applications today and is here to stay.

🌍 A world of components

The fundamental building block of React is the component. A component is simply a JavaScript function that returns what should appear on screen.

Here is the simplest possible React app. It's just a function called App that returns a div with some text in it. Read it carefully:

export default function App() {
  return (
    <div>
      <h1>Hello!</h1>
      <p>Welcome to the D3 Loves React course.</p>
    </div>
  );
}

That's it.

A simple React app with just one component called App. The code doesn't look too far from module A, does it? It's a JavaScript function that returns something that looks like HTML.

🧱 Composition: React is like Lego

What makes components powerful is composition. You can create other components and use them one or several times inside a parent component!

Oh no! 😱

It seems like you haven't enrolled in the course yet!

Join many other students today and learn how to create bespoke, interactive graphs with d3.js and React!

Enrollment is currently closed. Join the waitlist to be notified when doors reopen:

Or Login