Browse Source

[docs]: Updated CodePen links (#4232)

Signed-off-by: Aniruddha Shriwant <aniruddhashriwant@gmail.com>
main
Aniruddha Shriwant 3 years ago
committed by GitHub
parent
commit
f062ee271b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      content/docs/components-and-props.md
  2. 2
      content/docs/hello-world.md
  3. 2
      content/docs/introducing-jsx.md
  4. 6
      content/docs/rendering-elements.md

8
content/docs/components-and-props.md

@ -76,7 +76,7 @@ ReactDOM.render(
);
```
[](codepen://components-and-props/rendering-a-component)
**[Try it on CodePen](https://codepen.io/gaearon/pen/YGYmEG?editors=1010)**
Let's recap what happens in this example:
@ -118,7 +118,7 @@ ReactDOM.render(
);
```
[](codepen://components-and-props/composing-components)
**[Try it on CodePen](https://codepen.io/gaearon/pen/KgQKPr?editors=1010)**
Typically, new React apps have a single `App` component at the very top. However, if you integrate React into an existing app, you might start bottom-up with a small component like `Button` and gradually work your way to the top of the view hierarchy.
@ -152,7 +152,7 @@ function Comment(props) {
}
```
[](codepen://components-and-props/extracting-components)
**[Try it on CodePen](https://codepen.io/gaearon/pen/VKQwEo?editors=1010)**
It accepts `author` (an object), `text` (a string), and `date` (a date) as props, and describes a comment on a social media website.
@ -231,7 +231,7 @@ function Comment(props) {
}
```
[](codepen://components-and-props/extracting-components-continued)
**[Try it on CodePen](https://codepen.io/gaearon/pen/rrJNJY?editors=1010)**
Extracting components might seem like grunt work at first, but having a palette of reusable components pays off in larger apps. A good rule of thumb is that if a part of your UI is used several times (`Button`, `Panel`, `Avatar`), or is complex enough on its own (`App`, `FeedStory`, `Comment`), it is a good candidate to be extracted to a separate component.

2
content/docs/hello-world.md

@ -17,7 +17,7 @@ ReactDOM.render(
It displays a heading saying "Hello, world!" on the page.
[](codepen://hello-world)
**[Try it on CodePen](https://codepen.io/gaearon/pen/rrpgNB?editors=1010)**
Click the link above to open an online editor. Feel free to make some changes, and see how they affect the output. Most pages in this guide will have editable examples like this one.

2
content/docs/introducing-jsx.md

@ -68,7 +68,7 @@ ReactDOM.render(
);
```
[](codepen://introducing-jsx)
**[Try it on CodePen](https://codepen.io/gaearon/pen/PGEjdG?editors=1010)**
We split JSX over multiple lines for readability. While it isn't required, when doing this, we also recommend wrapping it in parentheses to avoid the pitfalls of [automatic semicolon insertion](https://stackoverflow.com/q/2846283).

6
content/docs/rendering-elements.md

@ -38,7 +38,7 @@ To render a React element into a root DOM node, pass both to [`ReactDOM.render()
`embed:rendering-elements/render-an-element.js`
[](codepen://rendering-elements/render-an-element)
**[Try it on CodePen](https://codepen.io/gaearon/pen/ZpvBNJ?editors=1010)**
It displays "Hello, world" on the page.
@ -52,7 +52,7 @@ Consider this ticking clock example:
`embed:rendering-elements/update-rendered-element.js`
[](codepen://rendering-elements/update-rendered-element)
**[Try it on CodePen](https://codepen.io/gaearon/pen/gwoJZk?editors=1010)**
It calls [`ReactDOM.render()`](/docs/react-dom.html#render) every second from a [`setInterval()`](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval) callback.
@ -66,7 +66,7 @@ It calls [`ReactDOM.render()`](/docs/react-dom.html#render) every second from a
React DOM compares the element and its children to the previous one, and only applies the DOM updates necessary to bring the DOM to the desired state.
You can verify by inspecting the [last example](codepen://rendering-elements/update-rendered-element) with the browser tools:
You can verify by inspecting the [last example](https://codepen.io/gaearon/pen/gwoJZk?editors=1010) with the browser tools:
![DOM inspector showing granular updates](../images/docs/granular-dom-updates.gif)

Loading…
Cancel
Save