Skip to content

Commit e813357

Browse files
committed
fix: dasherize internal links
1 parent 99392cb commit e813357

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

README.markdown

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Layout component](#layout-component)
1616
* [Container component](#container-component)
1717
* [Higher-order component](#higher-order-component)
18+
* [Prop hoisting](#prop-hoisting)
1819

1920
## Stateless function
2021

@@ -144,7 +145,7 @@ const Greeting = ({ name, ...props }) =>
144145
<div>Hi {name}!</div>
145146
```
146147

147-
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.
148149

149150
```js
150151
const Greeting = ({ name, ...props }) =>
@@ -214,7 +215,7 @@ React can render `children` of many types. In most cases it's either an `array`
214215
</div>
215216
```
216217

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.
218219

219220
`function`
220221

@@ -273,7 +274,7 @@ However, it can be used in component authoring for some serious power. This tech
273274

274275
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.
275276

276-
See [Render callbacks](#Render callback), for more details.
277+
See [Render callbacks](#render-callback), for more details.
277278

278279
## Render callback
279280

@@ -285,7 +286,7 @@ const Width = ({ children }) => children(500)
285286

286287
The component calls `children` as a function, with some number of arguments. Here, it's the number `500`.
287288

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).
289290

290291
```js
291292
<Width>
@@ -351,7 +352,7 @@ class WindowWidth extends React.Component {
351352
}
352353
```
353354

354-
Many developers favor [Higher Order Components](#Higher-order component) 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.
355356

356357

357358
## Children pass-through
@@ -415,7 +416,7 @@ We can use `Button` in place of `button` and ensure that the `type` attribute is
415416

416417
## Style component
417418

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.
419420

420421
Say we have a button. It uses classes to be styled as a "primary" button.
421422

@@ -582,7 +583,7 @@ We can write different containers for different application contexts.
582583

583584
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?
584585

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.
586587

587588
Let's start with our stateless `Greeting` component.
588589

@@ -628,4 +629,4 @@ Last step, we need to wrap our our `Greeting` component in `Connect`.
628629
const ConnectedMyComponent = Connect(Greeting)
629630
```
630631

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).

index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ <h2 id="contents">Contents</h2>
4747
<li><a href="#layout-component">Layout component</a></li>
4848
<li><a href="#container-component">Container component</a></li>
4949
<li><a href="#higher-order-component">Higher-order component</a></li>
50+
<li><a href="#prop-hoisting">Prop hoisting</a></li>
5051
</ul>
5152
<h2 id="stateless-function">Stateless function</h2>
5253
<p><a href="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>
@@ -158,7 +159,7 @@ <h2 id="destructuring-arguments">destructuring arguments</h2>
158159
</pre></div>
159160

160161
</code></pre>
161-
<p>In turn, this object can use <a href="#JSX Spread Attributes">JSX Spread Attributes</a> to forward <code>props</code> to the composed component.</p>
162+
<p>In turn, this object can use <a href="#jsx-spread-attributes">JSX Spread Attributes</a> to forward <code>props</code> to the composed component.</p>
162163
<pre><code class="lang-js"><div class="highlight"><pre><span class="kr">const</span> <span class="nx">Greeting</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">name</span><span class="p">,</span> <span class="p">...</span><span class="nx">props</span> <span class="p">})</span> <span class="o">=&gt;</span>
163164
<span class="o">&lt;</span><span class="nx">div</span> <span class="p">{...</span><span class="nx">props</span><span class="p">}</span><span class="o">&gt;</span><span class="nx">Hi</span> <span class="p">{</span><span class="nx">name</span><span class="p">}</span><span class="o">!&lt;</span><span class="err">/div&gt;</span>
164165
</pre></div>
@@ -214,7 +215,7 @@ <h2 id="children-types">Children types</h2>
214215
</pre></div>
215216

216217
</code></pre>
217-
<p>Functions may be used as children. However, it requires <a href="#Render callback">coordination with the parent component</a> to be useful.</p>
218+
<p>Functions may be used as children. However, it requires <a href="#render-callback">coordination with the parent component</a> to be useful.</p>
218219
<p><code>function</code></p>
219220
<pre><code class="lang-js"><div class="highlight"><pre><span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span>
220221
<span class="p">{()</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="k">return</span> <span class="s2">&quot;hello world!&quot;</span><span class="p">}()}</span>
@@ -260,15 +261,15 @@ <h2 id="function-as-children">Function as children</h2>
260261
</code></pre>
261262
<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>
262263
<p>This is a powerful technique used by libraries like <a href="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 <a href="#Render callback">Render callbacks</a>, for more details.</p>
264+
<p>See <a href="#render-callback">Render callbacks</a>, for more details.</p>
264265
<h2 id="render-callback">Render callback</h2>
265266
<p>Here’s a component that uses a Render callback. It’s not useful, but it’s an easy illustration to start with.</p>
266267
<pre><code class="lang-js"><div class="highlight"><pre><span class="kr">const</span> <span class="nx">Width</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">children</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="nx">children</span><span class="p">(</span><span class="mi">500</span><span class="p">)</span>
267268
</pre></div>
268269

269270
</code></pre>
270271
<p>The component calls <code>children</code> as a function, with some number of arguments. Here, it’s the number <code>500</code>.</p>
271-
<p>To use this component, we give it a <a href="#Function as children">function as <code>children</code></a>.</p>
272+
<p>To use this component, we give it a <a href="#function-as-children">function as <code>children</code></a>.</p>
272273
<pre><code class="lang-js"><div class="highlight"><pre><span class="o">&lt;</span><span class="nx">Width</span><span class="o">&gt;</span>
273274
<span class="p">{</span><span class="nx">width</span> <span class="o">=&gt;</span> <span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span><span class="nb">window</span> <span class="nx">is</span> <span class="p">{</span><span class="nx">width</span><span class="p">}</span><span class="o">&lt;</span><span class="err">/div&gt;}</span>
274275
<span class="o">&lt;</span><span class="err">/Width&gt;</span>
@@ -328,7 +329,7 @@ <h2 id="render-callback">Render callback</h2>
328329
</pre></div>
329330

330331
</code></pre>
331-
<p>Many developers favor <a href="#Higher-order component">Higher Order Components</a> for this type of functionality. It’s a matter of preference.</p>
332+
<p>Many developers favor <a href="#higher-order-component">Higher Order Components</a> for this type of functionality. It’s a matter of preference.</p>
332333
<h2 id="children-pass-through">Children pass-through</h2>
333334
<p>You might create a component designed to apply <code>context</code> and render its <code>children</code>.</p>
334335
<pre><code class="lang-js"><div class="highlight"><pre><span class="kr">class</span> <span class="nx">SomeContextProvider</span> <span class="kr">extends</span> <span class="nx">React</span><span class="p">.</span><span class="nx">Component</span> <span class="p">{</span>
@@ -380,7 +381,7 @@ <h2 id="proxy-component">Proxy component</h2>
380381

381382
</code></pre>
382383
<h2 id="style-component">Style component</h2>
383-
<p>This is a <a href="#Proxy component">Proxy component</a> applied to the practices of style.</p>
384+
<p>This is a <a href="#proxy-component">Proxy component</a> applied to the practices of style.</p>
384385
<p>Say we have a button. It uses classes to be styled as a “primary” button.</p>
385386
<pre><code class="lang-js"><div class="highlight"><pre><span class="o">&lt;</span><span class="nx">button</span> <span class="nx">type</span><span class="o">=</span><span class="s2">&quot;button&quot;</span> <span class="nx">className</span><span class="o">=</span><span class="s2">&quot;btn btn-primary&quot;</span><span class="o">&gt;</span>
386387
</pre></div>
@@ -519,7 +520,7 @@ <h2 id="container-component">Container component</h2>
519520
<p>We can write different containers for different application contexts.</p>
520521
<h2 id="higher-order-component">Higher-order component</h2>
521522
<p>A <a href="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 <a href="#Container component">container components</a>, these are just generic containers, wrapped up in a function.</p>
523+
<p>If you’re already using <a href="#container-component">container components</a>, these are just generic containers, wrapped up in a function.</p>
523524
<p>Let’s start with our stateless <code>Greeting</code> component.</p>
524525
<pre><code class="lang-js"><div class="highlight"><pre><span class="kr">const</span> <span class="nx">Greeting</span> <span class="o">=</span> <span class="p">({</span> <span class="nx">name</span> <span class="p">})</span> <span class="o">=&gt;</span> <span class="p">{</span>
525526
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">name</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="o">&lt;</span><span class="nx">div</span><span class="o">&gt;</span><span class="nx">Connecting</span><span class="p">...</span><span class="o">&lt;</span><span class="err">/div&gt; }</span>
@@ -560,7 +561,7 @@ <h2 id="higher-order-component">Higher-order component</h2>
560561
</pre></div>
561562

562563
</code></pre>
563-
<p>This is a powerful pattern for providing fetching and providing data to any number of <a href="#Stateless function">stateless function components</a>.</p>
564+
<p>This is a powerful pattern for providing fetching and providing data to any number of <a href="#stateless-function">stateless function components</a>.</p>
564565

565566
</div>
566567
<script>

0 commit comments

Comments
 (0)