Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element: start reexporting PureComponent #58076

Merged
merged 2 commits into from
Jan 23, 2024
Merged
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
2 changes: 2 additions & 0 deletions packages/element/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Started exporting the `PureComponent` React API ([#58076](https://github.com/WordPress/gutenberg/pull/58076)).

## 5.26.0 (2024-01-10)

## 5.25.0 (2023-12-13)
Expand Down
6 changes: 6 additions & 0 deletions packages/element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ const placeholderLabel = Platform.select( {
} );
```

### PureComponent

_Related_

- <https://reactjs.org/docs/react-api.html#reactpurecomponent>
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should link to the new docs:

Suggested change
- <https://reactjs.org/docs/react-api.html#reactpurecomponent>
- <https://react.dev/reference/react/PureComponent>

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps we should link to the new docs:

Why not, but let's do it for all references, in its own PR. Searching for "reactjs.org/docs" shows me 100 references, in various JSDoc comments and Markdown documents.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, although I didn't want to burden you with doing it for all existing usages 😅


### RawHTML

Component used as equivalent of Fragment with unescaped HTML, in cases where it is desirable to render dangerous HTML without needing a wrapper element. To preserve additional props, a `div` wrapper _will_ be created if any props aside from `children` are passed.
Expand Down
6 changes: 6 additions & 0 deletions packages/element/src/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Fragment,
isValidElement,
memo,
PureComponent,
StrictMode,
useCallback,
useContext,
Expand Down Expand Up @@ -238,6 +239,11 @@ export { lazy };
*/
export { Suspense };

/**
* @see https://reactjs.org/docs/react-api.html#reactpurecomponent
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @see https://reactjs.org/docs/react-api.html#reactpurecomponent
* @see https://react.dev/reference/react/PureComponent

*/
export { PureComponent };

/**
* Concatenate two or more React children objects.
*
Expand Down
Loading