diff --git a/content/docs/components-and-props.md b/content/docs/components-and-props.md index 0fd66045b..bed9f7ebe 100644 --- a/content/docs/components-and-props.md +++ b/content/docs/components-and-props.md @@ -76,7 +76,7 @@ ReactDOM.render( ); ``` -[](codepen://components-and-props/rendering-a-component). +[](codepen://components-and-props/rendering-a-component) Let's recap what happens in this example: @@ -118,7 +118,7 @@ ReactDOM.render( ); ``` -[](codepen://components-and-props/composing-components). +[](codepen://components-and-props/composing-components) 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). +[](codepen://components-and-props/extracting-components) 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). +[](codepen://components-and-props/extracting-components-continued) 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 a reusable component. diff --git a/content/docs/composition-vs-inheritance.md b/content/docs/composition-vs-inheritance.md index f65e321f1..4df4fad45 100644 --- a/content/docs/composition-vs-inheritance.md +++ b/content/docs/composition-vs-inheritance.md @@ -44,7 +44,7 @@ function WelcomeDialog() { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/ozqNOV?editors=0010) +**[Try it on CodePen](https://codepen.io/gaearon/pen/ozqNOV?editors=0010)** Anything inside the `` JSX tag gets passed into the `FancyBorder` component as a `children` prop. Since `FancyBorder` renders `{props.children}` inside a `
`, the passed elements appear in the final output. @@ -77,7 +77,7 @@ function App() { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/gwZOJp?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/gwZOJp?editors=0010) React elements like `` and `` are just objects, so you can pass them as props like any other data. This approach may remind you of "slots" in other libraries but there are no limitations on what you can pass as props in React. @@ -110,7 +110,7 @@ function WelcomeDialog() { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/kkEaOZ?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/kkEaOZ?editors=0010) Composition works equally well for components defined as classes: @@ -160,7 +160,7 @@ class SignUpDialog extends React.Component { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/gwZbYa?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/gwZbYa?editors=0010) ## So What About Inheritance? diff --git a/content/docs/conditional-rendering.md b/content/docs/conditional-rendering.md index f0fa1b369..68d0d0056 100644 --- a/content/docs/conditional-rendering.md +++ b/content/docs/conditional-rendering.md @@ -41,7 +41,7 @@ ReactDOM.render( ); ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/ZpVxNq?editors=0011) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/ZpVxNq?editors=0011) This example renders a different greeting depending on the value of `isLoggedIn` prop. @@ -115,7 +115,7 @@ ReactDOM.render( ); ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/QKzAgB?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/QKzAgB?editors=0010) While declaring a variable and using an `if` statement is a fine way to conditionally render a component, sometimes you might want to use a shorter syntax. There are a few ways to inline conditions in JSX, explained below. @@ -145,7 +145,7 @@ ReactDOM.render( ); ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/ozJddz?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/ozJddz?editors=0010) It works because in JavaScript, `true && expression` always evaluates to `expression`, and `false && expression` always evaluates to `false`. @@ -237,6 +237,6 @@ ReactDOM.render( ); ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/Xjoqwm?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/Xjoqwm?editors=0010) Returning `null` from a component's `render` method does not affect the firing of the component's lifecycle methods. For instance `componentDidUpdate` will still be called. diff --git a/content/docs/forms.md b/content/docs/forms.md index 989e89fd2..47455e940 100644 --- a/content/docs/forms.md +++ b/content/docs/forms.md @@ -64,7 +64,7 @@ class NameForm extends React.Component { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/VmmPgp?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/VmmPgp?editors=0010) Since the `value` attribute is set on our form element, the displayed value will always be `this.state.value`, making the React state the source of truth. Since `handleChange` runs on every keystroke to update the React state, the displayed value will update as the user types. @@ -178,7 +178,7 @@ class FlavorForm extends React.Component { } ``` -[Try it on CodePen.](https://codepen.io/gaearon/pen/JbbEzX?editors=0010) +[**Try it on CodePen**](https://codepen.io/gaearon/pen/JbbEzX?editors=0010) Overall, this makes it so that ``, `