Skip to content

Commit 8459140

Browse files
authored
HOC: add Use Cases (#754)
1 parent 15c1f00 commit 8459140

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/hoc/index.md

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ title: HOC Cheatsheet
1111
- Render props may be considered in the future
1212
- The goal is to write HOCs that offer type safety while not getting in the way.
1313

14+
There are a lot of use cases where an HOC is used. For example:
15+
16+
- HOCs can wrap components to check if a user is authenticated before rendering, or to restrict access based on user roles.
17+
- An HOC can conditionally render components based on feature flags or A/B testing.
18+
- An HOC can provide translation functionality to components.
19+
- An HOC can add logging or analytics tracking to components without modifying their core logic.
20+
1421
Here is a base HOC example you can copy right away:
1522

1623
```jsx

0 commit comments

Comments
 (0)