2The Foundation of React

React is a JavaScript library for creating interactive user interfaces using components. It was created by Facebook in 2011 for use on Facebook’s newsfeed and on Instagram. In 2013, the first version of React was released to the public as open source software. Today, it's used by many of the largest websites and mobile apps, including Facebook, Instagram, Netflix, Reddit, Dropbox, Airbnb, and thousands of others.

Writing user interfaces with React requires a bit of a shift in how you think about web applications. You need to understand what React is, how it works at a higher level, and the computer science ideas and patterns that it's based on. In this chapter, you'll learn:

  • Why it's called React.
  • What a Virtual DOM does.
  • The difference between composition and inheritance.
  • The difference between declarative and imperative programming.
  • The meaning of “idiomatic” with regard to React.

WHAT'S IN A NAME?

Let's start with the name “React.” Facebook designed React in response to its need to be able to efficiently update websites in response to events. Events that can trigger updates in websites include user input, new data coming into the application from other websites and data sources, and data coming into the application from sensors (such as location data from GPS chips).

Traditionally, the way that web applications have dealt with data that changes over time is to refresh themselves every so often, checking for new data in the process. Facebook wanted ...

Get Beginning ReactJS Foundations Building User Interfaces with ReactJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.