From 7306e0fccd4e7f60143a373a512b90113073021e Mon Sep 17 00:00:00 2001 From: Kafuu-Chinocya <38375027+Kafuu-Chinocya@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:54:37 +0800 Subject: [PATCH 1/2] fix(reference): missing parameter in hydrateRoot --- src/content/reference/react-dom/client/hydrateRoot.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/reference/react-dom/client/hydrateRoot.md b/src/content/reference/react-dom/client/hydrateRoot.md index 99190b03a76..8c1f3db5d87 100644 --- a/src/content/reference/react-dom/client/hydrateRoot.md +++ b/src/content/reference/react-dom/client/hydrateRoot.md @@ -380,10 +380,11 @@ By default, React will log all errors to the console. To implement your own erro ```js [[1, 6, "onCaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack", 15]] import { hydrateRoot } from "react-dom/client"; +import App from "./App.js"; import { reportCaughtError } from "./reportError"; const container = document.getElementById("root"); -const root = hydrateRoot(container, { +const root = hydrateRoot(container, , { onCaughtError: (error, errorInfo) => { if (error.message !== "Known error") { reportCaughtError({ From 2250a65e9b2108169ebb45ed35a98cd3dbf18d0c Mon Sep 17 00:00:00 2001 From: Kafuu_Chino Date: Wed, 9 Apr 2025 15:02:43 +0800 Subject: [PATCH 2/2] fix: highlights line mismatch --- src/content/reference/react-dom/client/hydrateRoot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/reference/react-dom/client/hydrateRoot.md b/src/content/reference/react-dom/client/hydrateRoot.md index 8c1f3db5d87..b74e2c38ee3 100644 --- a/src/content/reference/react-dom/client/hydrateRoot.md +++ b/src/content/reference/react-dom/client/hydrateRoot.md @@ -378,7 +378,7 @@ It is uncommon to call [`root.render`](#root-render) on a hydrated root. Usually By default, React will log all errors to the console. To implement your own error reporting, you can provide the optional error handler root options `onUncaughtError`, `onCaughtError` and `onRecoverableError`: -```js [[1, 6, "onCaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack", 15]] +```js [[1, 7, "onCaughtError"], [2, 7, "error", 1], [3, 7, "errorInfo"], [4, 11, "componentStack", 15]] import { hydrateRoot } from "react-dom/client"; import App from "./App.js"; import { reportCaughtError } from "./reportError";