You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a3f85fe
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CLAUDE.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code when working with this repository.
4
4
5
5
## Project Overview
6
6
7
-
This is the React documentation website (react.dev), built with Next.js 15.1.11 and React 19. Documentation is written in MDX format.
7
+
This is the React documentation website (react.dev), built with Next.js and React. See `package.json` for dependency versions and `.nvmrc` for the Node.js version used in development and CI. Documentation is written in MDX format.
8
8
9
9
## Development Commands
10
10
@@ -13,6 +13,7 @@ yarn build # Production build
13
13
yarn lint # Run ESLint
14
14
yarn lint:fix # Auto-fix lint issues
15
15
yarn tsc # TypeScript type checking
16
+
yarn ci-check # Run the same validation checks as CI
16
17
yarn check-all # Run prettier, lint:fix, tsc, and rss together
17
18
```
18
19
@@ -47,6 +48,6 @@ When editing files in `src/content/`, the appropriate skill will be auto-suggest
47
48
For MDX components (DeepDive, Pitfall, Note, etc.), invoke `/docs-components`.
48
49
For Sandpack code examples, invoke `/docs-sandpack`.
49
50
50
-
See `.claude/docs/react-docs-patterns.md` for comprehensive style guidelines.
51
+
See `.claude/skills/docs-voice/SKILL.md` for shared writing conventions, and the `docs-writer-learn`, `docs-writer-reference`, and `docs-writer-blog` skills for page-specific guidance.
51
52
52
53
Prettier is used for formatting (config in `.prettierrc`).
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4-30Lines changed: 4 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,41 +38,15 @@ Ignore this if you're specifically describing `createElement`.
38
38
39
39
Ignore this if you're specifically writing about ES5.
40
40
41
-
#### Don't use ES6 features when equivalent ES5 features have no downsides.
41
+
#### Prefer readable JavaScript.
42
42
43
-
Remember that ES6 is still new to a lot of people. While we use it in many places (`const` / `let`, classes, arrow functions), if the equivalent ES5 code is just as straightforward and readable, consider using it.
44
-
45
-
In particular, you should prefer named `function` declarations over `const myFunction = () => ...` arrows for top-level functions. However, you *should* use arrow functions where they provide a tangible improvement (such as preserving `this` context inside a component). Consider both sides of the tradeoff when deciding whether to use a new feature.
43
+
Use modern JavaScript when it makes an example clearer. Prefer named `function` declarations for components and top-level functions. Use arrow functions for inline callbacks where they improve readability.
46
44
47
45
#### Don't use features that aren't standardized yet.
48
46
49
-
For example, **don't** write this:
50
-
51
-
```js
52
-
classMyComponentextendsReact.Component {
53
-
state = {value:''};
54
-
handleChange= (e) => {
55
-
this.setState({value:e.target.value});
56
-
};
57
-
}
58
-
```
59
-
60
-
Instead, **do** write this:
61
-
62
-
```js
63
-
classMyComponentextendsReact.Component {
64
-
constructor(props) {
65
-
super(props);
66
-
this.handleChange=this.handleChange.bind(this);
67
-
this.state= {value:''};
68
-
}
69
-
handleChange(e) {
70
-
this.setState({value:e.target.value});
71
-
}
72
-
}
73
-
```
47
+
Use standardized JavaScript features in examples. Class fields are standardized and may be used when documenting class components. Prefer function components and Hooks for new examples, unless the page documents a class-specific API.
74
48
75
-
Ignore this rule if you're specifically describing an experimental proposal. Make sure to mention its experimental nature in the code and in the surrounding text.
49
+
If you're specifically describing an experimental proposal, mention its experimental nature in the code and surrounding text.
1.`yarn install --frozen-lockfile` to install the website's dependencies
19
24
20
25
### Running locally
21
26
22
27
1.`yarn dev` to start the development server (powered by [Next.js](https://nextjs.org/))
23
-
1.`open http://localhost:3000` to open the site in your favorite browser
28
+
1.Open [http://localhost:3000](http://localhost:3000)in your browser
24
29
25
30
## Contributing
26
31
@@ -31,33 +36,35 @@ The documentation is divided into several sections with a different tone and pur
31
36
### Create a branch
32
37
33
38
1.`git checkout main` from any folder in your local `react.dev` repository
34
-
1.`git pull origin main` to ensure you have the latest main code
39
+
1.`git fetch upstream` to get the latest changes from the source repo
40
+
1.`git merge --ff-only upstream/main` to update your local `main`
35
41
1.`git checkout -b the-name-of-my-branch` (replacing `the-name-of-my-branch` with a suitable name) to create a branch
36
42
37
43
### Make the change
38
44
39
45
1. Follow the ["Running locally"](#running-locally) instructions
40
46
1. Save the files and check in the browser
41
-
1. Changes to React components in `src` will hot-reload
42
-
1. Changes to markdown files in `content` will hot-reload
43
-
1. If working with plugins, you may need to remove the `.cache` directory and restart the server
47
+
1. Changes to React components in `src` will hot-reload
48
+
1. Changes to Markdown files in `src/content` will hot-reload
49
+
1. If changes to MDX plugins aren't reflected, stop the server, remove `node_modules/.cache/react-docs-mdx`, and restart it
44
50
45
51
### Test the change
46
52
47
53
1. If possible, test any visual changes in all latest versions of common browsers, on both desktop and mobile.
48
-
2. Run `yarn check-all`. (This will run Prettier, ESLint and validate types.)
54
+
1. Run `yarn ci-check` to run the same checks as CI: formatting, ESLint, local ESLint rule tests, TypeScript, heading IDs, RSS generation, and internal links.
55
+
1. To apply formatting and ESLint fixes, run `yarn check-all`. This command modifies files and also checks types and generates RSS. Review the resulting changes before committing.
49
56
50
57
### Push it
51
58
52
59
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
53
-
1.`git push my-fork-name the-name-of-my-branch`
60
+
1.`git push -u origin the-name-of-my-branch` to push the branch to your fork
54
61
1. Go to the [react.dev repo](https://github.com/reactjs/react.dev) and you should see recently pushed branches.
55
62
1. Follow GitHub's instructions.
56
63
1. If possible, include screenshots of visual changes. A preview build is triggered after your changes are pushed to GitHub.
57
64
58
65
## Translation
59
66
60
-
If you are interested in translating `react.dev`, please see the current translation efforts [here](https://github.com/reactjs/react.dev/issues/4135).
67
+
If you are interested in translating `react.dev`, see the [translation guide](https://react.dev/community/translations) and [current translation progress](https://translations.react.dev/).
61
68
62
69
## License
63
70
Content submitted to [react.dev](https://react.dev/) is CC-BY-4.0 licensed, as found in the [LICENSE-DOCS.md](https://github.com/reactjs/react.dev/blob/main/LICENSE-DOCS.md) file.
0 commit comments