Convert Figma logo to code with AI

reactjs logoreact.dev

The React documentation website

10,968
7,489
10,968
1,278

Top Related Projects

227,213

The library for web and native user interfaces.

46,633

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

95,657

Deliver web apps with confidence 🚀

78,194

Cybernetically enhanced web apps

36,546

⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.

32,037

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Quick Overview

React.dev is the official documentation website for React, a popular JavaScript library for building user interfaces. This repository contains the source code and content for the React documentation, providing comprehensive guides, tutorials, and API references for developers working with React.

Pros

  • Comprehensive and up-to-date documentation for React
  • Well-organized content structure for easy navigation
  • Includes interactive examples and code playgrounds
  • Supports multiple languages through translations

Cons

  • Large repository size due to extensive content and assets
  • May require frequent updates to keep pace with React's rapid development
  • Some advanced topics might be challenging for beginners
  • Limited community contributions due to strict review process

Getting Started

To run the React.dev website locally:

  1. Clone the repository:

    git clone https://github.com/reactjs/react.dev.git
    
  2. Install dependencies:

    cd react.dev
    npm install
    
  3. Start the development server:

    npm start
    
  4. Open your browser and visit http://localhost:3000 to view the website.

Note: This is not a code library, but rather a documentation website. The repository contains content, configuration, and build scripts for generating the React documentation site.

Competitor Comparisons

227,213

The library for web and native user interfaces.

Pros of React

  • Contains the core React library and related packages
  • Includes comprehensive test suites and build tools
  • Provides direct access to React's source code for deep understanding

Cons of React

  • Less beginner-friendly documentation
  • Requires more setup to start experimenting with React
  • May be overwhelming for those new to the library

Code Comparison

React (facebook/react):

import React from 'react';

function Example() {
  return <h1>Hello, world!</h1>;
}

React.dev (reactjs/react.dev):

function Example() {
  return <h1>Hello, world!</h1>;
}

Key Differences

  • React.dev focuses on documentation and learning resources
  • React contains the actual library code and development tools
  • React.dev offers an interactive learning environment
  • React provides access to the core implementation and related packages

Use Cases

  • Use React.dev for learning, tutorials, and documentation
  • Use React for contributing to the library or accessing core packages

Community and Support

  • Both repositories have active communities
  • React.dev encourages content contributions and translations
  • React accepts bug reports and feature requests for the library itself
46,633

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Pros of Vue.js core

  • Smaller bundle size and better performance for simple applications
  • More intuitive template syntax with less boilerplate code
  • Built-in state management solution (Vuex) tightly integrated with the framework

Cons of Vue.js core

  • Smaller ecosystem and community compared to React
  • Less suitable for large-scale, complex applications
  • Fewer job opportunities and resources available

Code Comparison

React:

function Welcome(props) {
  return <h1>Hello, {props.name}</h1>;
}

const element = <Welcome name="Sara" />;

Vue.js:

<template>
  <h1>Hello, {{ name }}</h1>
</template>

<script>
export default {
  props: ['name']
}
</script>

Summary

Vue.js core offers a more straightforward approach to building user interfaces, with a gentler learning curve and better performance for smaller projects. However, React.dev has a larger ecosystem, more community support, and is better suited for complex applications. The code comparison shows that Vue.js uses a template-based approach, while React uses JSX for rendering components. Both frameworks have their strengths, and the choice between them often depends on project requirements and team preferences.

95,657

Deliver web apps with confidence 🚀

Pros of Angular

  • Comprehensive framework with built-in tools for routing, forms, and HTTP client
  • TypeScript support out-of-the-box, providing better type checking and tooling
  • Dependency injection system for better modularity and testability

Cons of Angular

  • Steeper learning curve due to its more complex architecture
  • Larger bundle size, which can impact initial load times
  • More opinionated, potentially limiting flexibility in some scenarios

Code Comparison

Angular component:

@Component({
  selector: 'app-root',
  template: '<h1>{{title}}</h1>'
})
export class AppComponent {
  title = 'Hello, Angular!';
}

React component:

function App() {
  return (
    <h1>Hello, React!</h1>
  );
}

Angular uses a decorator-based approach with TypeScript, while React uses a more functional style with JSX. Angular's component definition includes metadata, whereas React's is a simple function. Both achieve similar results but with different syntax and structure.

Angular's architecture promotes a more structured approach, which can be beneficial for larger applications. React, on the other hand, offers more flexibility and a gentler learning curve, making it easier for beginners to get started.

78,194

Cybernetically enhanced web apps

Pros of Svelte

  • Smaller bundle size and better performance due to compile-time optimization
  • Simpler syntax with less boilerplate code
  • Built-in state management without additional libraries

Cons of Svelte

  • Smaller ecosystem and community compared to React
  • Fewer job opportunities and enterprise adoption
  • Limited tooling and third-party library support

Code Comparison

React:

function Counter() {
  const [count, setCount] = useState(0);
  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}

Svelte:

<script>
  let count = 0;
</script>

<button on:click={() => count++}>
  Count: {count}
</button>

The Svelte example demonstrates its more concise syntax, with built-in reactivity and no need for explicit state management functions. React, on the other hand, requires the use of hooks and a more verbose syntax to achieve the same functionality.

Both React and Svelte are powerful frameworks for building user interfaces, each with its own strengths and trade-offs. React offers a larger ecosystem and more widespread adoption, while Svelte provides a simpler development experience and potentially better performance for smaller applications.

36,546

⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.

Pros of Preact

  • Smaller bundle size (3KB vs React's ~40KB)
  • Faster performance due to lightweight implementation
  • API compatibility with React, allowing easy migration

Cons of Preact

  • Smaller ecosystem and community compared to React
  • Less extensive documentation and learning resources
  • Some advanced React features may not be available or require additional libraries

Code Comparison

Preact:

import { h, render } from 'preact';

const App = () => <h1>Hello, World!</h1>;
render(<App />, document.body);

React:

import React from 'react';
import ReactDOM from 'react-dom';

const App = () => <h1>Hello, World!</h1>;
ReactDOM.render(<App />, document.body);

The code structure is very similar, with Preact using a more compact import syntax. Both frameworks use JSX for component definition and rendering. The main difference lies in the rendering method, where Preact uses a single render function, while React separates it into React and ReactDOM.

32,037

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Pros of Solid

  • Smaller bundle size and faster runtime performance
  • Fine-grained reactivity without virtual DOM
  • Simpler mental model with less abstraction

Cons of Solid

  • Smaller ecosystem and community compared to React
  • Fewer learning resources and third-party libraries
  • Less mature tooling and developer experience

Code Comparison

React:

function Counter() {
  const [count, setCount] = useState(0);
  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}

Solid:

function Counter() {
  const [count, setCount] = createSignal(0);
  return (
    <button onClick={() => setCount(count() + 1)}>
      Count: {count()}
    </button>
  );
}

The code comparison shows similarities in syntax between React and Solid, but Solid uses signals instead of hooks for state management. Solid's approach eliminates the need for a virtual DOM, resulting in improved performance. However, React's larger ecosystem and extensive documentation make it easier for beginners to get started and find solutions to common problems. Solid's smaller footprint and fine-grained reactivity offer advantages for performance-critical applications, but developers may need to invest more time in learning the framework and building custom solutions due to its smaller ecosystem.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

react.dev

This repo contains the source code and documentation powering react.dev.

Getting started

Prerequisites

  1. Git
  2. Node: any 12.x version starting with v12.0.0 or greater
  3. Yarn: See Yarn website for installation instructions
  4. A fork of the repo (for any contributions)
  5. A clone of the react.dev repo on your local machine

Installation

  1. cd react.dev to go into the project root
  2. yarn to install the website's npm dependencies

Running locally

  1. yarn dev to start the development server (powered by Next.js)
  2. open http://localhost:3000 to open the site in your favorite browser

Contributing

Guidelines

The documentation is divided into several sections with a different tone and purpose. If you plan to write more than a few sentences, you might find it helpful to get familiar with the contributing guidelines for the appropriate sections.

Create a branch

  1. git checkout main from any folder in your local react.dev repository
  2. git pull origin main to ensure you have the latest main code
  3. git checkout -b the-name-of-my-branch (replacing the-name-of-my-branch with a suitable name) to create a branch

Make the change

  1. Follow the "Running locally" instructions
  2. Save the files and check in the browser
  3. Changes to React components in src will hot-reload
  4. Changes to markdown files in content will hot-reload
  5. If working with plugins, you may need to remove the .cache directory and restart the server

Test the change

  1. If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
  2. Run yarn check-all. (This will run Prettier, ESLint and validate types.)

Push it

  1. git add -A && git commit -m "My message" (replacing My message with a commit message, such as Fix header logo on Android) to stage and commit your changes
  2. git push my-fork-name the-name-of-my-branch
  3. Go to the react.dev repo and you should see recently pushed branches.
  4. Follow GitHub's instructions.
  5. If possible, include screenshots of visual changes. A preview build is triggered after your changes are pushed to GitHub.

Translation

If you are interested in translating react.dev, please see the current translation efforts here.

License

Content submitted to react.dev is CC-BY-4.0 licensed, as found in the LICENSE-DOCS.md file.