Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ const nextConfig = {
// Don't bundle the shim unnecessarily.
config.resolve.alias['use-sync-external-store/shim'] = 'react';

// ESLint depends on the CommonJS version of esquery,
// but Webpack loads the ESM version by default. This
// alias ensures the correct version is used.
//
// More info:
// https://github.com/reactjs/react.dev/pull/8115
config.resolve.alias['esquery'] = 'esquery/dist/esquery.min.js';

const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
config.plugins.push(
new NormalModuleReplacementPlugin(
Expand Down
7 changes: 0 additions & 7 deletions src/components/MDX/Sandpack/runESLint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ const getCodeMirrorPosition = (

const linter = new Linter();

// HACK! Eslint requires 'esquery' using `require`, but there's no commonjs interop.
// because of this it tries to run `esquery.parse()`, while there's only `esquery.default.parse()`.
// This hack places the functions in the right place.
const esquery = require('esquery');
esquery.parse = esquery.default?.parse;
esquery.matches = esquery.default?.matches;

const reactRules = require('eslint-plugin-react-hooks').rules;
linter.defineRules({
'react-hooks/rules-of-hooks': reactRules['rules-of-hooks'],
Expand Down
10 changes: 10 additions & 0 deletions src/content/reference/react/Component.md
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,16 @@ button { margin-left: 10px; }

デフォルトでは、アプリケーションがレンダー中にエラーをスローすると、React はその UI を画面から削除します。これを防ぐために、UI を*エラーバウンダリ*にラップすることができます。エラーバウンダリは、クラッシュした部位の代わりに、例えばエラーメッセージなどのフォールバック UI を表示するための、特別なコンポーネントです。

<Note>
以下の場合、エラーバウンダリはエラーをキャッチしません。

- イベントハンドラ[(詳細)](/learn/responding-to-events)
- [サーバサイドレンダリング](/reference/react-dom/server)
- エラーバウンダリ自身(子ではなく)でスローされたエラー
- 非同期コード(例えば `setTimeout` や `requestAnimationFrame` のコールバック)。ただし [`useTransition`](/reference/react/useTransition) フックが返す [`startTransition`](/reference/react/useTransition#starttransition) 関数の使用は例外です。トランジション関数内でスローされたエラーはエラーバウンダリでキャッチされます[(詳細)](/reference/react/useTransition#displaying-an-error-to-users-with-error-boundary)。

</Note>

エラーバウンダリコンポーネントを実装するためには、エラーに反応して state を更新し、ユーザにエラーメッセージを表示するための [`static getDerivedStateFromError`](#static-getderivedstatefromerror) を提供する必要があります。またオプションで、例えばエラーを分析サービスに記録するなどの追加のロジックを追加するために [`componentDidCatch`](#componentdidcatch) を実装することもできます。

[`captureOwnerStack`](/reference/react/captureOwnerStack) を使うことで開発中にオーナーのスタックトレースを含めることが可能です。
Expand Down
7 changes: 7 additions & 0 deletions src/sidebarBlog.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
"date": "October 7, 2025",
"path": "/blog/2025/10/07/introducing-the-react-foundation"
},
{
"title": "React 19.2",
"titleForHomepage": "React 19.2",
"icon": "blog",
"date": "October 1, 2025",
"path": "/blog/2025/10/01/react-19-2"
},
{
"title": "React Labs: ビュー遷移、Activity、その他もろもろ",
"titleForHomepage": "ビュー遷移と Activity",
Expand Down