Skip to content

Commit 02e8e5c

Browse files
Merge pull request #380 from reactjs/sync-8ed23b1a
2 parents eb1d398 + 7dce056 commit 02e8e5c

File tree

8 files changed

+50
-34
lines changed

8 files changed

+50
-34
lines changed

.github/workflows/analyze.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
# Here's the first place where next-bundle-analysis' own script is used
3939
# This step pulls the raw bundle stats for the current bundle
4040
- name: Analyze bundle
41-
run: npx -p nextjs-bundle-analysis report
41+
run: npx -p nextjs-bundle-analysis@0.5.0 report
4242

4343
- name: Upload bundle
4444
uses: actions/upload-artifact@v2

.github/workflows/analyze_comment.yml

+5-22
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,9 @@ jobs:
4747
pr_number=$(cat pr_number/pr_number)
4848
echo "pr-number=$pr_number" >> $GITHUB_OUTPUT
4949
50-
- name: Find Comment
51-
uses: peter-evans/find-comment@v1
52-
if: success()
53-
id: fc
54-
with:
55-
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
56-
body-includes: "<!-- __NEXTJS_BUNDLE -->"
57-
58-
- name: Create Comment
59-
uses: peter-evans/[email protected]
60-
if: success() && steps.fc.outputs.comment-id == 0
61-
with:
62-
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
63-
body: ${{ steps.get-comment-body.outputs.body }}
64-
65-
- name: Update Comment
66-
uses: peter-evans/[email protected]
67-
if: success() && steps.fc.outputs.comment-id != 0
50+
- name: Comment
51+
uses: marocchino/sticky-pull-request-comment@v2
6852
with:
69-
issue-number: ${{ steps.get-comment-body.outputs.pr-number }}
70-
body: ${{ steps.get-comment-body.outputs.body }}
71-
comment-id: ${{ steps.fc.outputs.comment-id }}
72-
edit-mode: replace
53+
header: next-bundle-analysis
54+
number: ${{ steps.get-comment-body.outputs.pr-number }}
55+
message: ${{ steps.get-comment-body.outputs.body }}

src/components/Layout/HomeContent.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,10 @@ function VideoList({videos, emptyHeading}) {
14631463
function SearchInput({value, onChange}) {
14641464
const id = useId();
14651465
return (
1466-
<form className="mb-3 py-1" data-hover="SearchInput">
1466+
<form
1467+
className="mb-3 py-1"
1468+
data-hover="SearchInput"
1469+
onSubmit={(e) => e.preventDefault()}>
14671470
<label htmlFor={id} className="sr-only">
14681471
Search
14691472
</label>

src/content/community/conferences.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
1010

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

13-
### React Miami 2023 {/*react-miami-2023*/}
14-
April 20 - 21, 2023. Miami, FL, USA
15-
16-
[Website](https://www.reactmiami.com/) - [Twitter](https://twitter.com/ReactMiamiConf)
17-
1813
### Reactathon 2023 {/*reactathon-2023*/}
1914
May 2 - 3, 2023. San Francisco, CA, USA
2015

@@ -92,6 +87,11 @@ December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity
9287

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

90+
### React Miami 2023 {/*react-miami-2023*/}
91+
April 20 - 21, 2023. Miami, FL, USA
92+
93+
[Website](https://www.reactmiami.com/) - [Twitter](https://twitter.com/ReactMiamiConf)
94+
9595
### React Day Berlin 2022 {/*react-day-berlin-2022*/}
9696
December 2, 2022. In-person in Berlin, Germany + remote (hybrid event)
9797

src/content/reference/react-dom/createPortal.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ title: createPortal
1010
```js
1111
<div>
1212
<SomeComponent />
13-
{createPortal(children, domNode)}
13+
{createPortal(children, domNode, key?)}
1414
</div>
1515
```
1616
@@ -22,7 +22,7 @@ title: createPortal
2222
2323
## Reference {/*reference*/}
2424
25-
### `createPortal(children, domNode)` {/*createportal*/}
25+
### `createPortal(children, domNode, key?)` {/*createportal*/}
2626
2727
To create a portal, call `createPortal`, passing some JSX, and the DOM node where it should be rendered:
2828
@@ -50,6 +50,8 @@ A portal only changes the physical placement of the DOM node. In every other way
5050
5151
* `domNode`: Some DOM node, such as those returned by `document.getElementById()`. The node must already exist. Passing a different DOM node during an update will cause the portal content to be recreated.
5252
53+
* **optional** `key`: A unique string or number to be used as the portal's [key.](/learn/rendering-lists/#keeping-list-items-in-order-with-key)
54+
5355
#### Returns {/*returns*/}
5456
5557
`createPortal` returns a React node that can be included into JSX or returned from a React component. If React encounters it in the render output, it will place the provided `children` inside the provided `domNode`.

src/content/reference/react/Component.md

+28
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,34 @@ Defining `defaultProps` in class components is similar to using [default values]
978978

979979
---
980980

981+
### `static propTypes` {/*static-proptypes*/}
982+
983+
You can define `static propTypes` together with the [`prop-types`](https://www.npmjs.com/package/prop-types) library to declare the types of the props accepted by your component. These types will be checked during rendering and in development only.
984+
985+
```js
986+
import PropTypes from 'prop-types';
987+
988+
class Greeting extends React.Component {
989+
static propTypes = {
990+
name: PropTypes.string
991+
};
992+
993+
render() {
994+
return (
995+
<h1>Hello, {this.props.name}</h1>
996+
);
997+
}
998+
}
999+
```
1000+
1001+
<Note>
1002+
1003+
We recommend using [TypeScript](https://www.typescriptlang.org/) instead of checking prop types at runtime.
1004+
1005+
</Note>
1006+
1007+
---
1008+
9811009
### `static getDerivedStateFromError(error)` {/*static-getderivedstatefromerror*/}
9821010

9831011
If you define `static getDerivedStateFromError`, React will call it when a child component (including distant children) throws an error during rendering. This lets you display an error message instead of clearing the UI.

src/content/reference/react/Fragment.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Post() {
5454
}
5555
```
5656

57-
Fragments are useful because grouping elements with a Fragment has no effect on layout or styles, unlike if you wrapped the elements in another container like a DOM element. If you inspect this example with the browser tools, you'll see that all `<h1>` and `<p>` DOM nodes appear as siblings without wrappers around them:
57+
Fragments are useful because grouping elements with a Fragment has no effect on layout or styles, unlike if you wrapped the elements in another container like a DOM element. If you inspect this example with the browser tools, you'll see that all `<h1>` and `<article>` DOM nodes appear as siblings without wrappers around them:
5858

5959
<Sandpack>
6060

src/content/reference/react/useMemo.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ To memoize a function with `useMemo`, your calculation function would have to re
11261126
export default function Page({ productId, referrer }) {
11271127
const handleSubmit = useMemo(() => {
11281128
return (orderDetails) => {
1129-
post('/product/' + product.id + '/buy', {
1129+
post('/product/' + productId + '/buy', {
11301130
referrer,
11311131
orderDetails
11321132
});
@@ -1142,7 +1142,7 @@ This looks clunky! **Memoizing functions is common enough that React has a built
11421142
```js {2,7}
11431143
export default function Page({ productId, referrer }) {
11441144
const handleSubmit = useCallback((orderDetails) => {
1145-
post('/product/' + product.id + '/buy', {
1145+
post('/product/' + productId + '/buy', {
11461146
referrer,
11471147
orderDetails
11481148
});

0 commit comments

Comments
 (0)