Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3b02f82
Update React DevTools docs to reference RN DevTools (#7355)
huntie Dec 11, 2024
9fb491d
Fix troubleshooting links in startTransition reference (#7367)
jimmycallin Dec 16, 2024
51864f6
(fix): mismatch href bug (#7368)
ahm3tozenir Dec 16, 2024
bc93f05
Fix stylesheet precedence example (#7235)
EricCote Dec 16, 2024
07eca83
Fix intro of prerenderToNodeStream (#7356)
smikitky Dec 16, 2024
c92bad2
chore: several major typo fixes (#7362)
coalio Dec 16, 2024
d3bd0f9
Update act.md (#7363)
huiliangShen Dec 16, 2024
31456db
chore: correct typo in useTransition docs (#7366)
AminDannak Dec 16, 2024
d4d1683
chore: fix a typo in startTransition docs (#7361)
AminDannak Dec 16, 2024
04ba43c
fix: add link to prop-type codemod (#7344)
renbaoshuo Dec 16, 2024
4349dd5
fix: anchor (#7343)
Jealh-h Dec 16, 2024
d3cde8f
Fix "won't break between majors" (#7357)
smikitky Dec 16, 2024
37e1ce9
Add React Summit 2025 to conferences.md; move past conferences to the…
denis-urban Dec 16, 2024
4b5ce91
Add missing react-error-boundary dependency (#7353)
acusti Dec 16, 2024
0805613
fix broken link in use server (#7351)
simon300000 Dec 16, 2024
a4b6074
fix: page does not exist (#7348)
nusr Dec 16, 2024
807e7fa
Mention that uncontrolled form elements are reset by form actions (#7…
jeremy-deutsch Dec 16, 2024
0f8bd80
Code example mistake in useMemo page (#7335)
JZZICK Dec 16, 2024
3558095
docs: include React 19 blog post in sidebarBlog.json (#7331)
slorber Dec 16, 2024
93a03f1
docs: Fix broken link to next.js Suspense docs (#7318)
ethshea Dec 16, 2024
204b3f1
Remove canary flag from useFormStatus (#7349)
smikitky Dec 16, 2024
8ac5531
Rename remaining "Server Actions" (#7352)
smikitky Dec 16, 2024
9985199
docs[compiler]: clarify React DevTools support for Compiler Badges in…
piotrski Dec 16, 2024
c37fdd3
Remove forwardref from useImperativeHandle docs (#7360)
SebassNoob Dec 16, 2024
e2bba41
docs: fix readme node version (#7316)
devwqc Dec 16, 2024
8a5526e
Update lauren (#7373)
poteto Dec 17, 2024
03e74dd
Add info about App.js 2025 conference (#7154)
piaskowyk Dec 18, 2024
8e41e32
Inline stylesheets are not Suspensey yet (#7378)
eps1lon Dec 19, 2024
1517494
refactor: remove unused useTransition import in App.js and update doc…
Rekl0w Dec 19, 2024
6ae99dd
Remove forwardRef references from useRef and Manipulating the DOM wit…
mattcarrollcode Dec 20, 2024
a30b9ee
merging all conflicts
react-translations-bot Dec 23, 2024
755621c
Resolve conflicts
smikitky Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This repo contains the source code and documentation powering [react.dev](https:
### Prerequisites

1. Git
1. Node: any 12.x version starting with v12.0.0 or greater
1. Node: any version starting with v16.8.0 or greater
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1. A fork of the repo (for any contributions)
1. A clone of the [react.dev repo](https://github.com/reactjs/react.dev) on your local machine
Expand Down
Binary file modified public/images/team/lauren.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/content/blog/2024/04/25/react-19-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ npx codemod@latest react/19/migration-recipe
- [`replace-string-ref`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-string-ref)
- [`replace-act-import`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-act-import)
- [`replace-use-form-state`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-use-form-state)
- [`prop-types-typescript`](TODO)
- [`prop-types-typescript`](https://codemod.com/registry/react-prop-types-typescript)

これには TypeScript 関連の変更は含まれていません。以下の [TypeScript 関連の変更](#typescript-changes)を参照してください。

Expand Down
4 changes: 2 additions & 2 deletions src/content/blog/2024/12/05/react-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ React 19 には、Canary チャンネルにあったすべての React Server Co

#### サーバコンポーネントのサポートを追加する方法 {/*how-do-i-build-support-for-server-components*/}

React 19 の React Server Components は安定しており、メジャーバージョン間での破壊的変更はありませんが、サーバコンポーネントのバンドラやフレームワークを実装するために使用される基盤となる API は semver に従いません。React 19.x のマイナーバージョン間で変更が生じる可能性があります。
React 19 の React Server Components は安定しており、マイナーバージョン間での破壊的変更はありませんが、サーバコンポーネントのバンドラやフレームワークを実装するために使用される基盤となる API は semver に従いません。React 19.x のマイナーバージョン間で変更が生じる可能性があります。

React Server Components をバンドラやフレームワークでサポートする場合は、特定の React バージョンに固定するか、Canary リリースを使用することをお勧めします。React Server Components を実装するために使用される API を安定化させるため、今後もバンドラやフレームワークと連携を続けていきます。

Expand Down Expand Up @@ -807,4 +807,4 @@ React におけるカスタム要素のサポートに関し、設計と実装
#### アップグレード方法 {/*how-to-upgrade*/}
アップグレードに関するステップバイステップのガイドや、重要な変更点の完全なリストについては、[React 19 アップグレードガイド](/blog/2024/04/25/react-19-upgrade-guide)を参照してください。

_Note: this post was originally published 04/25/2024 and has been updated to 12/05/2024 with the stable release._
_Note: this post was originally published 04/25/2024 and has been updated to 12/05/2024 with the stable release._
73 changes: 42 additions & 31 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,73 @@ title: React カンファレンス

## Upcoming Conferences {/*upcoming-conferences*/}

### React Universe Conf 2024 {/*react-universe-conf-2024*/}
September 5-6, 2024. Wrocław, Poland.
### React Day Berlin 2024 {/*react-day-berlin-2024*/}
December 13 & 16, 2024. In-person in Berlin, Germany + remote (hybrid event)

[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)
[Website](https://reactday.berlin/) - [Twitter](https://x.com/reactdayberlin)

### React Alicante 2024 {/*react-alicante-2024*/}
September 19-21, 2024. Alicante, Spain.
### App.js Conf 2025 {/*appjs-conf-2025*/}
May 28 - 30, 2025. In-person in Kraków, Poland + remote

[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)
[Website](https://appjs.co) - [Twitter](https://twitter.com/appjsconf)

### RenderCon Kenya 2024 {/*rendercon-kenya-2024*/}
October 04 - 05, 2024. Nairobi, Kenya
### React Summit 2025 {/*react-summit-2025*/}
June 13 - 17, 2025. In-person in Amsterdam, Netherlands + remote (hybrid event)

[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)
[Website](https://reactsummit.com/) - [Twitter](https://x.com/reactsummit)

### React India 2024 {/*react-india-2024*/}
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
## Past Conferences {/*past-conferences*/}

[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
### React Africa 2024 {/*react-africa-2024*/}
November 29, 2024. In-person in Casablanca, Morocco (hybrid event)

### React Brussels 2024 {/*react-brussels-2024*/}
October 18, 2024. In-person in Brussels, Belgium (hybrid event)
[Website](https://react-africa.com/) - [Twitter](https://x.com/BeJS_)

[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)
### React Summit US 2024 {/*react-summit-us-2024*/}
November 19 & 22, 2024. In-person in New York, USA + online (hybrid event)

### reactjsday 2024 {/*reactjsday-2024*/}
October 25, 2024. In-person in Verona, Italy + online (hybrid event)
[Website](https://reactsummit.us/) - [Twitter](https://twitter.com/reactsummit) - [Videos](https://portal.gitnation.org/)

[Website](https://2024.reactjsday.it/) - [Twitter](https://x.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)
### React Native London Conf 2024 {/*react-native-london-2024*/}
November 14 & 15, 2024. In-person in London, UK

[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)

### React Advanced London 2024 {/*react-advanced-london-2024*/}
October 25 & 28, 2024. In-person in London, UK + online (hybrid event)

[Website](https://reactadvanced.com/) - [Twitter](https://x.com/reactadvanced)

### React Native London Conf 2024 {/*react-native-london-2024*/}
November 14 & 15, 2024. In-person in London, UK
### reactjsday 2024 {/*reactjsday-2024*/}
October 25, 2024. In-person in Verona, Italy + online (hybrid event)

[Website](https://reactnativelondon.co.uk/) - [Twitter](https://x.com/RNLConf)
[Website](https://2024.reactjsday.it/) - [Twitter](https://x.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)

### React Summit US 2024 {/*react-summit-us-2024*/}
November 19 & 22, 2024. In-person in New York, USA + online (hybrid event)
### React Brussels 2024 {/*react-brussels-2024*/}
October 18, 2024. In-person in Brussels, Belgium (hybrid event)

[Website](https://reactsummit.us/) - [Twitter](https://twitter.com/reactsummit) - [Videos](https://portal.gitnation.org/)
[Website](https://www.react.brussels/) - [Twitter](https://x.com/BrusselsReact)

### React Africa 2024 {/*react-africa-2024*/}
November 29, 2024. In-person in Casablanca, Morocco (hybrid event)
### React India 2024 {/*react-india-2024*/}
October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day

[Website](https://react-africa.com/) - [Twitter](https://x.com/BeJS_)
[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)

### React Day Berlin 2024 {/*react-day-berlin-2024*/}
December 13 & 16, 2024. In-person in Berlin, Germany + remote (hybrid event)
### RenderCon Kenya 2024 {/*rendercon-kenya-2024*/}
October 04 - 05, 2024. Nairobi, Kenya

[Website](https://reactday.berlin/) - [Twitter](https://x.com/reactdayberlin)
[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)

### React Alicante 2024 {/*react-alicante-2024*/}
September 19-21, 2024. Alicante, Spain.

[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/ReactAlicante) - [YouTube](https://www.youtube.com/channel/UCaSdUaITU1Cz6PvC97A7e0w)

### React Universe Conf 2024 {/*react-universe-conf-2024*/}
September 5-6, 2024. Wrocław, Poland.

[Website](https://www.reactuniverseconf.com/) - [Twitter](https://twitter.com/react_native_eu) - [LinkedIn](https://www.linkedin.com/events/reactuniverseconf7163919537074118657/)

## Past Conferences {/*past-conferences*/}

### React Rally 2024 🐙 {/*react-rally-2024*/}
August 12-13, 2024. Park City, UT, USA
Expand Down
2 changes: 1 addition & 1 deletion src/content/community/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ React コアチームのメンバーは、コアコンポーネントの API、R
</TeamMember>

<TeamMember name="Lauren Tan" permalink="lauren-tan" photo="/images/team/lauren.jpg" github="poteto" twitter="potetotes" threads="potetotes" bsky="no.lol" title="Engineer at Meta">
Lauren のプログラミングキャリアは `<marquee>` タグを初めて見たときにピークを迎えました。それ以来、彼女はその時の高揚感を追い続けています。大学ではコンピュータサイエンスではなく経済学を学んでいたため、コーディングは Java ではなく Excel で学びました。Lauren はチャットでお茶目なミームを投下したり、パートナとゲームを楽しんだり、犬の Zelda を可愛がったりするのが好きです。
Lauren のプログラミングキャリアは `<marquee>` タグを初めて見たときにピークを迎えました。それ以来、彼女はその時の高揚感を追い続けています。大学ではコンピュータサイエンスではなく経済学を学んでいたため、コーディングは Excel で学びました。Lauren はチャットでお茶目なミームを投下したり、パートナとゲームを楽しんだり、韓国語を学んだり、犬の Zelda を可愛がったりするのが好きです。
</TeamMember>

<TeamMember name="Luna Wei" permalink="luna-wei" photo="/images/team/luna-wei.jpg" github="lunaleaps" twitter="lunaleaps" threads="lunaleaps" title="Engineer at Meta">
Expand Down
92 changes: 24 additions & 68 deletions src/content/learn/manipulating-the-dom-with-refs.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,75 +343,39 @@ Strict Mode が有効の場合、ref コールバックは開発環境で 2 回

## 別のコンポーネントの DOM ノードにアクセスする {/*accessing-another-components-dom-nodes*/}

`<input />` のようなブラウザ要素を出力する組み込みコンポーネントに ref を置いた場合、React はその ref の `current` プロパティを、対応する DOM ノード(ブラウザの実際の `<input />` など)にセットします。
<Pitfall>
ref は避難ハッチです。他のコンポーネントの DOM ノードを手作業で書き換えるとコードは壊れやすくなってしまいます。
</Pitfall>

ただし、**独自の**コンポーネント、例えば `<MyInput />` に ref を置こうとすると、デフォルトでは `null` が返されます。以下はそれを示す例です。ボタンをクリックしても入力フィールドにフォーカスが当たらないことに注意してください
親コンポーネントからは、[普通の props と全く同じやり方で](/learn/passing-props-to-a-component)子コンポーネントに ref を渡すことができます

<Sandpack>

```js
```js {3-4,9}
import { useRef } from 'react';

function MyInput(props) {
return <input {...props} />;
function MyInput({ ref }) {
return <input ref={ref} />;
}

export default function MyForm() {
function MyForm() {
const inputRef = useRef(null);

function handleClick() {
inputRef.current.focus();
}

return (
<>
<MyInput ref={inputRef} />
<button onClick={handleClick}>
Focus the input
</button>
</>
);
return <MyInput ref={inputRef} />
}
```

</Sandpack>

問題に気付きやすくするため、React はコンソールにもエラーを出力します。

<ConsoleBlock level="error">

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

</ConsoleBlock>

これは、デフォルトでは React は、コンポーネントが他のコンポーネントの DOM ノードにアクセスできないようにしているためです。自分自身の子でさえもです! これは意図的なものです。ただでさえ ref は控えめに使うべき避難ハッチ (escape hatch) です。*別の*コンポーネントの DOM ノードまで手動で操作できてしまうと、コードがさらに壊れやすくなってしまいます。

代わりに、内部の DOM ノードを*意図的に*公開したいコンポーネントは、そのことを**明示的に許可**する必要があります。コンポーネントは、自身が受け取った ref を子のいずれかに「転送 (forward)」するよう指定できます。`MyInput` が `forwardRef` API を使ってこれをどのように行うのか見てみましょう。

```js
const MyInput = forwardRef((props, ref) => {
return <input {...props} ref={ref} />;
});
```

以下が動作の仕組みです。

1. `<MyInput ref={inputRef} />` は、対応する DOM ノードを `inputRef.current` に入れるように React に指示する。ただしそれを許可するかどうかは `MyInput` 次第であり、デフォルトでは許可しない。
2. `MyInput` コンポーネントは `forwardRef` を使って宣言されている。**これにより、上記の `inputRef` を `props` の後に宣言された 2 番目の `ref` 引数として受け取るよう、明示的に許可している**。
3. `MyInput` 自体は、受け取った `ref` を内部の `<input>` に渡す。
上記の例では、ref が親コンポーネントである `MyForm` で作成されており、それが子コンポーネントである `MyInput` に渡されています。`MyInput` は更にその ref を `<input>` に受け渡しています。`<input>` は[組み込みコンポーネント](/reference/react-dom/components/common)なので、React は ref の `.current` プロパティに `<input>` DOM 要素を代入します。

これで、ボタンをクリックして入力にフォーカスを当てることができます
これで `MyForm` で作られた `inputRef` は、`MyInput` から返される `<input>` DOM 要素を指し示すようになります。`MyForm` で作成されたクリックハンドラは `inputRef` にアクセスして `focus()` を呼び出し、`<input>` にフォーカスを設定できるようになります

<Sandpack>

```js
import { forwardRef, useRef } from 'react';
import { useRef } from 'react';

const MyInput = forwardRef((props, ref) => {
return <input {...props} ref={ref} />;
});
function MyInput({ ref }) {
return <input ref={ref} />;
}

export default function Form() {
export default function MyForm() {
const inputRef = useRef(null);

function handleClick() {
Expand All @@ -431,33 +395,27 @@ export default function Form() {

</Sandpack>

デザインシステムにおいて、ボタン、入力フィールドなどの低レベルなコンポーネントが、内部の DOM ノードに ref を転送することは一般的なパターンです。一方、フォーム、リスト、ページセクションなどの高レベルなコンポーネントは、DOM 構造への偶発的な依存関係を避けるため、通常は DOM ノードを公開しません。

<DeepDive>

#### 命令型ハンドルで API の一部を公開する {/*exposing-a-subset-of-the-api-with-an-imperative-handle*/}

上記の例では、`MyInput` は元の DOM input 要素を公開しています。これにより親コンポーネント側からその要素の `focus()` を呼び出すことができます。しかしこれにより、親コンポーネントが他のこと、例えば、CSS スタイルを変更することもできてしまいます。一般的なことではありませんが、公開される機能を制限したいということがあります。それには `useImperativeHandle` を使います。
上記の例では、`MyInput` に渡された ref が本来の DOM 要素である input に受け渡されています。これにより親コンポーネント側からその要素の `focus()` を呼び出すことができます。しかしこれにより、親コンポーネントが他のこと、例えば、CSS スタイルを変更することもできてしまいます。一般的なことではありませんが、公開される機能を制限したいということがあります。それには [`useImperativeHandle`](/reference/react/useImperativeHandle) を使います。

<Sandpack>

```js
import {
forwardRef,
useRef,
useImperativeHandle
} from 'react';
import { useRef, useImperativeHandle } from "react";

const MyInput = forwardRef((props, ref) => {
function MyInput({ ref }) {
const realInputRef = useRef(null);
useImperativeHandle(ref, () => ({
// Only expose focus and nothing else
focus() {
realInputRef.current.focus();
},
}));
return <input {...props} ref={realInputRef} />;
});
return <input ref={realInputRef} />;
};

export default function Form() {
const inputRef = useRef(null);
Expand All @@ -469,17 +427,15 @@ export default function Form() {
return (
<>
<MyInput ref={inputRef} />
<button onClick={handleClick}>
Focus the input
</button>
<button onClick={handleClick}>Focus the input</button>
</>
);
}
```

</Sandpack>

ここでは、`MyInput` 内の `realInputRef` が本物の DOM の input ノードを保持しています。ただし、`useImperativeHandle` は、親コンポーネントに対して渡す ref の値として、独自の特別なオブジェクトを使うよう、React に指示します。そのため、`Form` コンポーネント内の `inputRef.current` には `focus` メソッドのみが含まれます。この例での、ref "handle" とは DOM ノードではなく、`useImperativeHandle` の呼び出し内で作成するカスタムオブジェクトです。
ここでは、`MyInput` 内の `realInputRef` が本物の DOM の input ノードを保持しています。ただし、[`useImperativeHandle`](/reference/react/useImperativeHandle) は、親コンポーネントに対して渡す ref の値として、独自の特別なオブジェクトを使うよう、React に指示します。そのため、`Form` コンポーネント内の `inputRef.current` には `focus` メソッドのみが含まれます。この例での、ref "handle" とは DOM ノードではなく、[`useImperativeHandle`](/reference/react/useImperativeHandle) の呼び出し内で作成するカスタムオブジェクトです。

</DeepDive>

Expand Down Expand Up @@ -591,7 +547,7 @@ export default function TodoList() {
const newTodo = { id: nextId++, text: text };
flushSync(() => {
setText('');
setTodos([ ...todos, newTodo]);
setTodos([ ...todos, newTodo]);
});
listRef.current.lastChild.scrollIntoView({
behavior: 'smooth',
Expand Down
Loading
Loading