Skip to content
Merged
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/content/reference/react-dom/client/hydrateRoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, <App />, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch but this causes a crash now:
Screenshot 2025-04-08 at 9 34 43 AM

This happens because the lines listed on 381 are now off by one. Can you update it so it still highlights like this:
Screenshot 2025-04-08 at 9 37 35 AM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Och! Thank for the catch, Let me fix it.

onCaughtError: (error, errorInfo) => {
if (error.message !== "Known error") {
reportCaughtError({
Expand Down