React

19.2.5 · active · verified Sat Apr 18

React is a JavaScript library for building user interfaces, currently at version 19.2.5. It focuses on declarative UI development and a component-based architecture. Recent patch releases primarily include stability and security enhancements for React Server Components (RSC), indicating a rapid release cadence for critical updates, alongside updates for its ecosystem tooling like `eslint-plugin-react-hooks`.

Common errors

Warnings

Install

Imports

Quickstart

A basic functional component demonstrating state management with the `useState` hook and rendered using `createRoot`.

import React, { useState } from 'react';
import ReactDOM from 'react-dom/client';

function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}

// Render the component
const root = ReactDOM.createRoot(document.getElementById('root') ?? document.createElement('div'));
root.render(<Counter />);

view raw JSON →