Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9bd0d50

Browse files
authoredDec 25, 2023
Merge pull request #37 from reactjs/sync-bbb08a5a
2 parents ee9c177 + b61e762 commit 9bd0d50

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed
 

‎src/components/MDX/Sandpack/Preview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function Preview({
5454

5555
// When throwing a new Error in Sandpack - we want to disable the dev error dialog
5656
// to show the Error Boundary fallback
57-
if (rawError && rawError.message.includes(`throw Error('Example error')`)) {
57+
if (rawError && rawError.message.includes('Example Error:')) {
5858
rawError = null;
5959
}
6060

‎src/components/Seo.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const deployedTranslations = [
2424
'es',
2525
'fr',
2626
'ja',
27+
'tr',
2728
// We'll add more languages when they have enough content.
2829
// Please DO NOT edit this list without a discussion in the reactjs/react.dev repo.
2930
// It must be the same between all translations.

‎src/content/learn/understanding-your-ui-as-a-tree.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ React, and many other UI libraries, model UI as a tree. Thinking of your app as
2222

2323
Trees are a relationship model between items and UI is often represented using tree structures. For example, browsers use tree structures to model HTML ([DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model/Introduction)) and CSS ([CSSOM](https://developer.mozilla.org/docs/Web/API/CSS_Object_Model)). Mobile platforms also use trees to represent their view hierarchy.
2424

25-
<Diagram name="preserving_state_dom_tree" height={193} width={864} alt="Diagram with three sections arranged horizontally. In the first section, there are three rectangles stacked vertically, with labels 'Component A', 'Component B', and 'Component C'. Transitioning to the next pane is an arrow with the React logo on top labeled 'React'. The middle section contains a tree of components, with the root labeled 'A' and two children labeled 'B' and 'C'. The next section is again transitioned using an arrow with the React logo on top labeled 'React'. The third and final section is a wireframe of a browser, containing a tree of 8 nodes, which has only a subset highlighted (indicating the subtree from the middle section).">
25+
<Diagram name="preserving_state_dom_tree" height={193} width={864} alt="Diagram with three sections arranged horizontally. In the first section, there are three rectangles stacked vertically, with labels 'Component A', 'Component B', and 'Component C'. Transitioning to the next pane is an arrow with the React logo on top labeled 'React'. The middle section contains a tree of components, with the root labeled 'A' and two children labeled 'B' and 'C'. The next section is again transitioned using an arrow with the React logo on top labeled 'React DOM'. The third and final section is a wireframe of a browser, containing a tree of 8 nodes, which has only a subset highlighted (indicating the subtree from the middle section).">
2626

2727
React creates a UI tree from your components. In this example, the UI tree is then used to render to the DOM.
2828
</Diagram>

‎src/content/reference/react-dom/components/common.md

+2
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,8 @@ textarea { display: block; margin-top: 5px; margin-bottom: 10px; }
982982
983983
</Sandpack>
984984
985+
The `{__html}` object should be created as close to where the HTML is generated as possible, like the above example does in the `renderMarkdownToHTML` function. This ensures that all raw HTML being used in your code is explicitly marked as such, and that only variables that you expect to contain HTML are passed to `dangerouslySetInnerHTML`. It is not recommended to create the object inline like `<div dangerouslySetInnerHTML={{__html: markup}} />`.
986+
985987
To see why rendering arbitrary HTML is dangerous, replace the code above with this:
986988
987989
```js {1-4,7,8}

‎src/content/reference/react/useTransition.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -1520,15 +1520,15 @@ import { ErrorBoundary } from "react-error-boundary";
15201520
export function AddCommentContainer() {
15211521
return (
15221522
<ErrorBoundary fallback={<p>⚠️Something went wrong</p>}>
1523-
<AddCommentButton />
1523+
<AddCommentButton />
15241524
</ErrorBoundary>
15251525
);
15261526
}
15271527

15281528
function addComment(comment) {
15291529
// For demonstration purposes to show Error Boundary
1530-
if(comment == null){
1531-
throw Error('Example error')
1530+
if (comment == null) {
1531+
throw new Error("Example Error: An error thrown to trigger error boundary");
15321532
}
15331533
}
15341534

@@ -1544,9 +1544,10 @@ function AddCommentButton() {
15441544
// so error gets thrown
15451545
addComment();
15461546
});
1547-
}}>
1548-
Add comment
1549-
</button>
1547+
}}
1548+
>
1549+
Add comment
1550+
</button>
15501551
);
15511552
}
15521553
```

0 commit comments

Comments
 (0)
Please sign in to comment.