mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-21 19:31:57 +00:00
Misc captureOwnerStack cleanup after stable release (#7710)
1. Stop using `canary` for `captureOwnerStack` sandboxes 1. Remove remaining Canary badges from `captureOwnerStack` mentions
This commit is contained in:
committed by
GitHub
parent
6a548a8551
commit
b77c05d807
@@ -1273,7 +1273,7 @@ By default, if your application throws an error during rendering, React will rem
|
||||
|
||||
To implement an error boundary component, you need to provide [`static getDerivedStateFromError`](#static-getderivedstatefromerror) which lets you update state in response to an error and display an error message to the user. You can also optionally implement [`componentDidCatch`](#componentdidcatch) to add some extra logic, for example, to log the error to an analytics service.
|
||||
|
||||
<CanaryBadge /> With [`captureOwnerStack`](/reference/react/captureOwnerStack) you can include the Owner Stack during development.
|
||||
With [`captureOwnerStack`](/reference/react/captureOwnerStack) you can include the Owner Stack during development.
|
||||
|
||||
```js {9-12,14-27}
|
||||
import * as React from 'react';
|
||||
@@ -1298,8 +1298,7 @@ class ErrorBoundary extends React.Component {
|
||||
// in div (created by App)
|
||||
// in App
|
||||
info.componentStack,
|
||||
// Only available in react@canary.
|
||||
// Warning: Owner Stack is not available in production.
|
||||
// Warning: `captureOwnerStack` is not available in production.
|
||||
React.captureOwnerStack(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,22 +120,6 @@ createRoot(document.createElement('div'), {
|
||||
);
|
||||
```
|
||||
|
||||
```json package.json hidden
|
||||
{
|
||||
"dependencies": {
|
||||
"react": "canary",
|
||||
"react-dom": "canary",
|
||||
"react-scripts": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```html public/index.html hidden
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -351,22 +335,6 @@ const container = document.getElementById("root");
|
||||
createRoot(container).render(<App />);
|
||||
```
|
||||
|
||||
```json package.json hidden
|
||||
{
|
||||
"dependencies": {
|
||||
"react": "canary",
|
||||
"react-dom": "canary",
|
||||
"react-scripts": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```js src/App.js
|
||||
function Component() {
|
||||
return <button onClick={() => console.error('Some console error')}>Trigger console.error()</button>;
|
||||
@@ -411,22 +379,6 @@ export default function App() {
|
||||
}
|
||||
```
|
||||
|
||||
```json package.json hidden
|
||||
{
|
||||
"dependencies": {
|
||||
"react": "canary",
|
||||
"react-dom": "canary",
|
||||
"react-scripts": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Sandpack>
|
||||
|
||||
### `captureOwnerStack` is not available {/*captureownerstack-is-not-available*/}
|
||||
|
||||
Reference in New Issue
Block a user