A declarative, efficient, and flexible JavaScript library for building user interfaces. reactjs.org
Go to file
Ruslan Lesiutin ff6e05a705
chore[react-devtools]: unify console patching and default to ansi escape symbols (#29869)
Stacked on https://github.com/facebook/react/pull/29856.

## Summary

By default, React DevTools will apply dimming with ANSI escape symbols,
so it works for both terminals and browser consoles.

For Firefox, which doesn't support ANSI escape symbols console stylings,
we fallback to css properties, like we used to do before.

## How did you test this change?

| Environment | Dark mode | Light mode |
|--------|--------|--------|
| Terminal | ![Screenshot 2024-06-12 at 19 39
46](https://github.com/facebook/react/assets/28902667/2d470eee-ec5f-4362-be7d-8d80c6c72d09)
| ![Screenshot 2024-06-12 at 19 39
09](https://github.com/facebook/react/assets/28902667/616f2c58-a251-406b-aee6-841e07d652ba)
|
| Fusebox console | ![Screenshot 2024-06-12 at 21 03
14](https://github.com/facebook/react/assets/28902667/6050f730-8e82-4aa1-acbc-7179aac3a8aa)
| ![Screenshot 2024-06-12 at 21 02
48](https://github.com/facebook/react/assets/28902667/6708b938-8a90-476f-a057-427963d58caa)
|
| Firefox console | ![Screenshot 2024-06-12 at 21 40
29](https://github.com/facebook/react/assets/28902667/4721084f-bbfa-438c-b61b-395da8ded590)
| ![Screenshot 2024-06-12 at 21 40
42](https://github.com/facebook/react/assets/28902667/72bbf001-2d3d-49e7-91c9-20a4f0914d4d)
|
| Chrome console | ![Screenshot 2024-06-12 at 21 43
09](https://github.com/facebook/react/assets/28902667/93c47881-a0dd-44f8-8dc2-8710149774e5)
| ![Screenshot 2024-06-12 at 21 43
00](https://github.com/facebook/react/assets/28902667/07ea4ff5-4322-4db9-9c12-4321d9577c9d)
|
2024-06-17 16:31:36 +01:00
.circleci Add xplat test variants (#29734) 2024-06-04 13:07:29 -04:00
.codesandbox Codesandbox: upgrade to Node.js 18 (#26330) 2023-03-06 15:38:03 -05:00
.github Fix xplat sync syntax error 2024-06-10 13:30:30 -04:00
compiler [compiler] Support method-call version of macro functions 2024-06-17 08:17:24 -07:00
fixtures Bump braces from 3.0.2 to 3.0.3 in /fixtures/flight-esm (#29857) 2024-06-12 11:17:06 -04:00
packages chore[react-devtools]: unify console patching and default to ansi escape symbols (#29869) 2024-06-17 16:31:36 +01:00
scripts chore[react-devtools]: unify console patching and default to ansi escape symbols (#29869) 2024-06-17 16:31:36 +01:00
.editorconfig https link to editorconfig.org (#18421) 2020-03-29 15:18:52 +01:00
.eslintignore Fix ESLint and Prettier configs for React Compiler (#29073) 2024-05-15 14:02:57 -07:00
.eslintrc.js chore[react-devtools]: unify console patching and default to ansi escape symbols (#29869) 2024-06-17 16:31:36 +01:00
.git-blame-ignore-revs Update .git-blame-ignore-revs 2024-05-29 18:12:16 +09:00
.gitattributes .gitattributes to ensure LF line endings when we should 2014-01-17 16:25:53 -08:00
.gitignore feat[devtools]: add package for fusebox integration (#28553) 2024-04-12 15:29:35 +01:00
.mailmap updates mailmap entries (#19824) 2020-09-12 13:05:52 -04:00
.nvmrc Bump nvmrc to Node.js v18 (#28707) 2024-04-02 10:04:19 -04:00
.prettierignore Fix ESLint and Prettier configs for React Compiler (#29073) 2024-05-15 14:02:57 -07:00
.prettierrc.js created a vscode workspace file for the repo (#29830) 2024-06-13 16:23:42 +01:00
.watchmanconfig .watchmanconfig must be valid json (#16118) 2019-07-11 19:01:02 -07:00
babel.config.js Upgrade tests to use react/jsx-runtime (#28252) 2024-02-05 23:07:41 -05:00
CHANGELOG-canary.md Add useActionState to CHANGELOG-canary.md (#28632) 2024-03-26 13:15:08 -04:00
CHANGELOG.md Add changelog for 18.3.1 (#28932) 2024-04-26 16:03:03 -04:00
CODE_OF_CONDUCT.md revert last grammatical edit (#25067) 2022-08-10 20:14:31 +01:00
CONTRIBUTING.md Fix: Updated link in CONTRIBUTING (#25381) 2022-10-03 10:29:57 -04:00
dangerfile.js [Tooling] Update critical artifact list (#28966) 2024-05-02 07:39:10 -07:00
LICENSE [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
netlify.toml [UMD] Remove umd builds (#28735) 2024-04-17 11:15:27 -07:00
package.json Add jest lint rules (#29760) 2024-06-10 14:31:37 -04:00
react.code-workspace created a vscode workspace file for the repo (#29830) 2024-06-13 16:23:42 +01:00
ReactVersions.js Update build script to automatically generate RCs (#29736) 2024-06-03 12:21:21 -04:00
README.md feat(hyperlink): added a hyperlink to Node in README.md file (#28940) 2024-05-18 23:17:52 -04:00
SECURITY.md Create SECURITY.md (#15784) 2020-01-09 14:07:41 -08:00
yarn.lock Add jest lint rules (#29760) 2024-06-10 14:31:37 -04:00

React · GitHub license npm version CircleCI Status PRs Welcome

React is a JavaScript library for building user interfaces.

  • Declarative: React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
  • Component-Based: Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep the state out of the DOM.
  • Learn Once, Write Anywhere: We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using React Native.

Learn how to use React in your project.

Installation

React has been designed for gradual adoption from the start, and you can use as little or as much React as you need:

Documentation

You can find the React documentation on the website.

Check out the Getting Started page for a quick overview.

The documentation is divided into several sections:

You can improve it by sending pull requests to this repository.

Examples

We have several examples on the website. Here is the first one to get you started:

import { createRoot } from 'react-dom/client';

function HelloMessage({ name }) {
  return <div>Hello {name}</div>;
}

const root = createRoot(document.getElementById('container'));
root.render(<HelloMessage name="Taylor" />);

This example will render "Hello Taylor" into a container on the page.

You'll notice that we used an HTML-like syntax; we call it JSX. JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML.

Contributing

The main purpose of this repository is to continue evolving React core, making it faster and easier to use. Development of React happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving React.

Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React.

Good First Issues

To help you get your feet wet and get you familiar with our contribution process, we have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started.

License

React is MIT licensed.