react
React is the most popular JavaScript library for building user interfaces, developed and maintained by Meta (formerly Facebook). React introduced the component-…
Installation
npm install react
yarn add react
pnpm add react
Import
import { useState } from 'react';Quick Example
function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
Count: {count}
</button>
);
}About react
React is the most popular JavaScript library for building user interfaces, developed and maintained by Meta (formerly Facebook). React introduced the component-based architecture and virtual DOM concepts that have become standard across modern frontend development. Components in React are JavaScript functions that return JSX, a syntax extension that looks like HTML but compiles to JavaScript function calls. React's declarative approach means developers describe what the UI should look like for a given state, and React efficiently updates the DOM to match. The library introduced hooks in version 16.8, providing useState, useEffect, useContext, useReducer, and other primitives for managing state and side effects in function components. React 18 brought concurrent features including automatic batching, transitions, Suspense for data fetching, and streaming server-side rendering. React Server Components, introduced with React 19, allow components to run exclusively on the server, reducing client-side JavaScript. React's ecosystem is the largest in frontend development, with thousands of libraries, tools, and learning resources available.
Quick Facts
| Package | react |
| Category | Framework |
| Weekly Downloads | 25M+ |
| License | MIT |
| Install | npm install react |
Related Packages
React DOM is the package that provides DOM-specific methods for React, serving as the entry point to…
Next.js is the leading React framework for building full-stack web applications, developed and maint…
Preact is a fast 3kB alternative to React with the same modern API. It provides the thinnest possibl…
Vue.js is a progressive JavaScript framework for building user interfaces, created by Evan You in 20…
Svelte is a radical new approach to building user interfaces that shifts the work of the framework f…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.