Skip to content

Commit 03dae5b

Browse files
author
Krzysztof Borowy
committed
Reuse images in blog/docs. Remove intends
1 parent eb42882 commit 03dae5b

6 files changed

+11
-11
lines changed

content/blog/2017-07-26-error-handling-in-react-16.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ We also encourage you to use JS error reporting services (or build your own) so
7979

8080
React 16 prints all errors that occurred during rendering to the console in development, even if the application accidentally swallows them. In addition to the error message and the JavaScript stack, it also provides component stack traces. Now you can see where exactly in the component tree the failure has happened:
8181

82-
<img src="../images/blog/error-boundaries-stack-trace.png" alt="Component stack traces in error message" style="width: 100%;">
82+
<img src="../images/docs/error-boundaries-stack-trace.png" alt="Component stack traces in error message" style="width: 100%;">
8383

8484
You can also see the filenames and line numbers in the component stack trace. This works by default in [Create React App](https://github.com/facebookincubator/create-react-app) projects:
8585

86-
<img src="../images/blog/error-boundaries-stack-trace-line-numbers.png" alt="Component stack traces with line numbers in error message" style="width: 100%;">
86+
<img src="../images/docs/error-boundaries-stack-trace-line-numbers.png" alt="Component stack traces with line numbers in error message" style="width: 100%;">
8787

8888
If you don’t use Create React App, you can add [this plugin](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source) manually to your Babel configuration. Note that it’s intended only for development and **must be disabled in production**.
8989

content/docs/error-boundaries.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The `componentDidCatch()` method works like a JavaScript `catch {}` block, but f
5151

5252
Note that **error boundaries only catch errors in the components below them in the tree**. An error boundary can’t catch an error within itself. If an error boundary fails trying to render the error message, the error will propagate to the closest error boundary above it. This, too, is similar to how catch {} block works in JavaScript.
5353

54-
#### componentDidCatch Parameters
54+
### componentDidCatch Parameters
5555

5656
`error` is an error that has been thrown.
5757

@@ -100,11 +100,11 @@ We also encourage you to use JS error reporting services (or build your own) so
100100

101101
React 16 prints all errors that occurred during rendering to the console in development, even if the application accidentally swallows them. In addition to the error message and the JavaScript stack, it also provides component stack traces. Now you can see where exactly in the component tree the failure has happened:
102102

103-
<img src="../images/docs/error-boundaries-error-log.png" style="max-width:100%" alt="Error caught by Error Boundary component">
103+
<img src="../images/docs/error-boundaries-stack-trace.png" style="max-width:100%" alt="Error caught by Error Boundary component">
104104

105105
You can also see the filenames and line numbers in the component stack trace. This works by default in [Create React App](https://github.com/facebookincubator/create-react-app) projects:
106106

107-
<img src="../images/docs/error-boundaries-error-log-line-numbers.png" style="max-width:100%" alt="Error caught by Error Boundary component with line numbers">
107+
<img src="../images/docs/error-boundaries-stack-trace-line-numbers.png" style="max-width:100%" alt="Error caught by Error Boundary component with line numbers">
108108

109109
If you don’t use Create React App, you can add [this plugin](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source) manually to your Babel configuration. Note that it’s intended only for development and **must be disabled in production**.
110110

@@ -114,17 +114,17 @@ If you don’t use Create React App, you can add [this plugin](https://www.npmjs
114114
`try` / `catch` is great but it only works for imperative code:
115115

116116
```js
117-
try {
118-
showButton();
119-
} catch (error) {
120-
// ...
121-
}
117+
try {
118+
showButton();
119+
} catch (error) {
120+
// ...
121+
}
122122
```
123123

124124
However, React components are declarative and specify *what* should be rendered:
125125

126126
```js
127-
<Button />
127+
<Button />
128128
```
129129

130130
Error boundaries preserve the declarative nature of React, and behave as you would expect. For example, even if an error occurs in a `componentDidUpdate` hook caused by a `setState` somewhere deep in the tree, it will still correctly propagate to the closest error boundary.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)