Top Related Projects
The library for web and native user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Deliver web apps with confidence 🚀
Cybernetically enhanced web apps
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
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:
-
Clone the repository:
git clone https://github.com/reactjs/react.dev.git
-
Install dependencies:
cd react.dev npm install
-
Start the development server:
npm start
-
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
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
🖖 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.
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.
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.
⚛️ 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
.
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 designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
react.dev
This repo contains the source code and documentation powering react.dev.
Getting started
Prerequisites
- Git
- Node: any 12.x version starting with v12.0.0 or greater
- Yarn: See Yarn website for installation instructions
- A fork of the repo (for any contributions)
- A clone of the react.dev repo on your local machine
Installation
cd react.dev
to go into the project rootyarn
to install the website's npm dependencies
Running locally
yarn dev
to start the development server (powered by Next.js)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
git checkout main
from any folder in your localreact.dev
repositorygit pull origin main
to ensure you have the latest main codegit checkout -b the-name-of-my-branch
(replacingthe-name-of-my-branch
with a suitable name) to create a branch
Make the change
- Follow the "Running locally" instructions
- Save the files and check in the browser
- Changes to React components in
src
will hot-reload - Changes to markdown files in
content
will hot-reload - If working with plugins, you may need to remove the
.cache
directory and restart the server
Test the change
- If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
- Run
yarn check-all
. (This will run Prettier, ESLint and validate types.)
Push it
git add -A && git commit -m "My message"
(replacingMy message
with a commit message, such asFix header logo on Android
) to stage and commit your changesgit push my-fork-name the-name-of-my-branch
- Go to the react.dev repo and you should see recently pushed branches.
- Follow GitHub's instructions.
- 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.
Top Related Projects
The library for web and native user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Deliver web apps with confidence 🚀
Cybernetically enhanced web apps
⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot