You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In turn, this object can use [JSX Spread Attributes](#JSX Spread Attributes) to forward `props` to the composed component.
148
+
In turn, this object can use [JSX Spread Attributes](#jsx-spread-attributes) to forward `props` to the composed component.
148
149
149
150
```js
150
151
constGreeting= ({ name, ...props }) =>
@@ -214,7 +215,7 @@ React can render `children` of many types. In most cases it's either an `array`
214
215
</div>
215
216
```
216
217
217
-
Functions may be used as children. However, it requires [coordination with the parent component](#Render callback) to be useful.
218
+
Functions may be used as children. However, it requires [coordination with the parent component](#render-callback) to be useful.
218
219
219
220
`function`
220
221
@@ -273,7 +274,7 @@ However, it can be used in component authoring for some serious power. This tech
273
274
274
275
This is a powerful technique used by libraries like [ReactMotion](https://github.com/chenglou/react-motion). When applied, rendering logic can be kept in the owner component, instead of being delegated.
275
276
276
-
See [Render callbacks](#Render callback), for more details.
277
+
See [Render callbacks](#render-callback), for more details.
The component calls `children` as a function, with some number of arguments. Here, it's the number `500`.
287
288
288
-
To use this component, we give it a [function as `children`](#Function as children).
289
+
To use this component, we give it a [function as `children`](#function-as-children).
289
290
290
291
```js
291
292
<Width>
@@ -351,7 +352,7 @@ class WindowWidth extends React.Component {
351
352
}
352
353
```
353
354
354
-
Many developers favor [Higher Order Components](#Higher-ordercomponent) for this type of functionality. It's a matter of preference.
355
+
Many developers favor [Higher Order Components](#higher-order-component) for this type of functionality. It's a matter of preference.
355
356
356
357
357
358
## Children pass-through
@@ -415,7 +416,7 @@ We can use `Button` in place of `button` and ensure that the `type` attribute is
415
416
416
417
## Style component
417
418
418
-
This is a [Proxy component](#Proxy component) applied to the practices of style.
419
+
This is a [Proxy component](#proxy-component) applied to the practices of style.
419
420
420
421
Say we have a button. It uses classes to be styled as a "primary" button.
421
422
@@ -582,7 +583,7 @@ We can write different containers for different application contexts.
582
583
583
584
A [higher-order function](https://en.wikipedia.org/wiki/Higher-order_function) is a function that takes and/or returns a function. It's not more complicated than that. So, what's a higher-order component?
584
585
585
-
If you're already using [container components](#Container component), these are just generic containers, wrapped up in a function.
586
+
If you're already using [container components](#container-component), these are just generic containers, wrapped up in a function.
586
587
587
588
Let's start with our stateless `Greeting` component.
588
589
@@ -628,4 +629,4 @@ Last step, we need to wrap our our `Greeting` component in `Connect`.
628
629
constConnectedMyComponent=Connect(Greeting)
629
630
```
630
631
631
-
This is a powerful pattern for providing fetching and providing data to any number of [stateless function components](#Stateless function).
632
+
This is a powerful pattern for providing fetching and providing data to any number of [stateless function components](#stateless-function).
<p><ahref="https://facebook.github.io/react/docs/components-and-props.html">Stateless functions</a> are a brilliant way to define highly reusable components. They don’t hold <code>state</code> or <code>refs</code>; they’re just functions.</p>
@@ -260,15 +261,15 @@ <h2 id="function-as-children">Function as children</h2>
260
261
</code></pre>
261
262
<p>However, it can be used in component authoring for some serious power. This technique is commonly referred to as <code>render callbacks</code>.</p>
262
263
<p>This is a powerful technique used by libraries like <ahref="https://github.com/chenglou/react-motion">ReactMotion</a>. When applied, rendering logic can be kept in the owner component, instead of being delegated.</p>
263
-
<p>See <ahref="#Render callback">Render callbacks</a>, for more details.</p>
264
+
<p>See <ahref="#render-callback">Render callbacks</a>, for more details.</p>
264
265
<h2id="render-callback">Render callback</h2>
265
266
<p>Here’s a component that uses a Render callback. It’s not useful, but it’s an easy illustration to start with.</p>
<p>A <ahref="https://en.wikipedia.org/wiki/Higher-order_function">higher-order function</a> is a function that takes and/or returns a function. It’s not more complicated than that. So, what’s a higher-order component?</p>
522
-
<p>If you’re already using <ahref="#Container component">container components</a>, these are just generic containers, wrapped up in a function.</p>
523
+
<p>If you’re already using <ahref="#container-component">container components</a>, these are just generic containers, wrapped up in a function.</p>
523
524
<p>Let’s start with our stateless <code>Greeting</code> component.</p>
<p>This is a powerful pattern for providing fetching and providing data to any number of <ahref="#Stateless function">stateless function components</a>.</p>
564
+
<p>This is a powerful pattern for providing fetching and providing data to any number of <ahref="#stateless-function">stateless function components</a>.</p>
0 commit comments