React

What is it?

React is a JavaScript library developed by Meta (Facebook) for building user interfaces, particularly single-page applications. It uses a component-based architecture where UIs are built from independent, reusable pieces. React's virtual DOM efficiently updates only changed elements, and its declarative approach lets developers describe what the UI should look like for any given state.

Practical example

A React shopping cart component uses the useState hook to track items and their quantities. When a user clicks Add to Cart, an event handler calls setItems to update the state, which automatically triggers a re-render showing the new item. The component receives product data as props from its parent, keeping it reusable. UseEffect handles side effects like fetching data when the component mounts.

Test your knowledge

What is JSX in React?

Ask Lex
Lex knows the context of this term and can give targeted explanations, examples, and extra context.
Tip: Lex replies briefly in the widget. For more detail, go to full screen mode.

Quick links