Skip to content

Commit 3114f3a

Browse files
author
sw-yx
committed
add links
1 parent d51511c commit 3114f3a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

HOC.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
In this first section we refer closely to [the React docs on HOCs](https://reactjs.org/docs/higher-order-components.html) and offer direct TypeScript parallels.
2424

25-
## Docs Example: Use HOCs For Cross-Cutting Concerns
25+
## Docs Example: [Use HOCs For Cross-Cutting Concerns](https://reactjs.org/docs/higher-order-components.html#use-hocs-for-cross-cutting-concerns)
2626

2727
<details>
2828

@@ -164,7 +164,7 @@ export const BlogPostWithSubscription = withSubscription(
164164
);
165165
```
166166

167-
## Docs Example: Don’t Mutate the Original Component. Use Composition.
167+
## Docs Example: [Don’t Mutate the Original Component. Use Composition.](https://reactjs.org/docs/higher-order-components.html#dont-mutate-the-original-component-use-composition)
168168

169169
This is pretty straightforward - make sure to assert the passed props as `T` [due to the TS 3.2 bug](https://github.com/Microsoft/TypeScript/issues/28938#issuecomment-450636046).
170170

@@ -185,11 +185,11 @@ function logProps<T>(WrappedComponent: React.ComponentType<T>) {
185185
}
186186
```
187187

188-
## Docs Example: Pass Unrelated Props Through to the Wrapped Component
188+
## Docs Example: [Pass Unrelated Props Through to the Wrapped Component](https://reactjs.org/docs/higher-order-components.html#convention-pass-unrelated-props-through-to-the-wrapped-component)
189189

190190
No TypeScript specific advice needed here.
191191

192-
## Docs Example: Maximizing Composability
192+
## Docs Example: [Maximizing Composability](https://reactjs.org/docs/higher-order-components.html#convention-maximizing-composability)
193193

194194
HOCs can take the form of Functions that return Higher Order Components that return Components.
195195

@@ -277,7 +277,7 @@ function connect(mapStateToProps: Function, mapDispatchToProps: Function) {
277277
}
278278
```
279279

280-
## Docs Example: Wrap the Display Name for Easy Debugging
280+
## Docs Example: [Wrap the Display Name for Easy Debugging](https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging)
281281

282282
This is pretty straightforward as well.
283283

@@ -303,7 +303,7 @@ function getDisplayName<T>(WrappedComponent: React.ComponentType<T>) {
303303
}
304304
```
305305

306-
## Unwritten
306+
## Unwritten: [Caveats section](https://reactjs.org/docs/higher-order-components.html#caveats)
307307

308308
- Don’t Use HOCs Inside the render Method
309309
- Static Methods Must Be Copied Over

0 commit comments

Comments
 (0)