Home › Categories › Web Development › React

React

From WikiTech, the encyclopedia of technology

Technology · Web Development · 4 min read · 891 words · Updated

React
Technology
React — article photograph or illustration
Image placeholderPlace the file shown below in the assets/articles folder
File: react.webp
Original authorJordan Walke
Initial release2013
Written inJavaScript
Websitereact.dev

React is a library for building user interfaces. Developers describe the interface as a function of state, and React updates the browser DOM when state changes.

History

React was created by Jordan Walke at Facebook and open-sourced in 2013. Hooks, which allow state in function components, arrived in version 16.8 in February 2019.

Architecture

Components return a tree of elements. React compares the new tree with the previous one (reconciliation) and applies the minimal set of DOM changes. Data flows one way, from parent to child through props.

function Counter() {
  const [n, setN] = useState(0);
  return <button onClick={() => setN(n + 1)}>{n}</button>;
}

Key mechanisms

Rendering depends on the browser's Event Loop; React schedules updates so long renders do not block input. Server rendering and hydration generate HTML on the server and attach behaviour in the browser.

Adoption

React is used in web and, through React Native, mobile applications. Frameworks such as Next.js build routing and server rendering on top of it.

Ecosystem

React is a library, not a full framework, so routing and data fetching come from separate packages.

Components and declarative rendering

React applications are built from components. A component receives inputs, commonly called props, and returns a description of the interface. Components can be nested to form a tree, which makes it possible to divide a large screen into smaller parts with clear responsibilities. A component should generally describe what the interface should look like for a given state rather than manually editing many DOM elements itself.

State represents information that can change over time, such as whether a menu is open or what a user has typed into a form. When state changes, React renders the component again and compares the new element tree with the previous one. It then updates the browser DOM as needed. This process is often called reconciliation. It allows developers to express interfaces declaratively while React manages the mechanics of updating the page.

Hooks and data flow

Hooks such as useState, useEffect, useMemo and useContext let function components manage state, coordinate with external systems and share values. Hooks follow rules about where they may be called so React can associate each hook with the right component instance. Effects are intended for synchronising with systems outside React, such as subscriptions or browser APIs; they should not be used as a substitute for ordinary data derivation.

React encourages one-way data flow. A parent passes values to children through props, and a child can notify its parent through callback props. This makes the source of a value easier to trace than a system where any component can modify any other component's state directly. Larger applications may use context or external state libraries when values need to be shared broadly.

Rendering, events and the browser

React integrates with the browser's event system and scheduling model. Event handlers respond to user actions, while rendering updates the interface. React's scheduling can prioritise some updates and keep interfaces responsive, but expensive synchronous JavaScript still blocks the main browser thread. Large computations should be moved to workers or split into smaller tasks when they would otherwise delay input and rendering.

The library can render on the client, on the server or through a combination of both. Server-side rendering sends an initial HTML representation to the browser, and hydration attaches React behaviour to that markup. Frameworks build on these capabilities with routing, data loading, server components and deployment conventions. The exact model depends on the framework and React version being used.

Ecosystem and application architecture

React focuses on the user-interface layer rather than prescribing a complete application architecture. Developers choose routing, data fetching, forms, styling, testing and build tools. Frameworks such as Next.js and others provide integrated conventions for those concerns. This flexibility supports many kinds of projects, but it also means teams must make choices and maintain consistency across a codebase.

A component library can improve reuse, but excessive abstraction can make simple screens harder to understand. Good component boundaries follow meaningful interface responsibilities and data ownership. Testing should cover user-visible behaviour as well as important component logic, and accessibility should be considered when designing keyboard interaction, semantic elements and screen-reader labels.

Strengths and limitations

React's component model and broad ecosystem make it suitable for interactive interfaces that change frequently. It has a large community, extensive documentation and integration with many development tools. However, performance and maintainability still depend on architecture. Unnecessary state, unstable keys, repeated expensive calculations and deeply coupled components can make an application difficult to reason about.

React does not remove the need to understand HTML, CSS, JavaScript and browser behaviour. It is a tool for managing UI state and rendering, not a replacement for web fundamentals. Teams get the most benefit when they use React to clarify interface structure instead of adding complexity without a clear need.

Editorial connections and engineering implications

React describes a user interface as components whose output depends on props and state. When state changes, React renders and reconciles the affected component tree. Rendering should remain a description of the interface; network requests, subscriptions and manual browser API integration need deliberate lifecycle handling. State should live at the lowest level that needs it, and duplicated copies of the same information can become inconsistent.

Performance optimisation should follow measurement. Memoisation can avoid repeated work but can also make code harder to understand if used without need. Lists need stable keys, and large interfaces may benefit from code splitting or virtualisation. React does not replace browser fundamentals: HTML provides semantics, CSS controls presentation and JavaScript supplies the language. Accessibility still depends on labels, keyboard support, focus management and semantic elements.

See also

  • JavaScript – The programming language that powers interactive web pages and a large ecosystem of browser, server and desktop software.
  • Event Loop – A programming construct that waits for and dispatches events or messages in a single thread of control.
  • TypeScript – A language that extends JavaScript with a static type system and compiles to ordinary JavaScript.
  • CSS – The style sheet language that controls the presentation, layout and responsive behaviour of HTML documents.
  • HTML – The standard markup language used to structure documents and applications on the World Wide Web.
  • GitHub – A web platform for hosting Git repositories and collaborating on software with pull requests, issues, automation and apps.
  • HTTP/3 – The third major version of the Hypertext Transfer Protocol, which runs over QUIC instead of TCP.
  • WebAssembly – A portable binary instruction format that runs at near-native speed in browsers and other runtimes.

References

  1. ↑ React Documentation (react.dev)