Skip to content
This repository was archived by the owner on Nov 12, 2023. It is now read-only.

Commit 4a8ec13

Browse files
committed
18. New to hooks
1 parent d7698a8 commit 4a8ec13

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- [Animating the clap count](#animating-the-clap-count)
1818
- [Creating animated bursts!](#creating-animated-bursts)
1919
- [**Section 3: Custom Hooks: The first Foundational Pattern**](#section-3-custom-hooks-the-first-foundational-pattern)
20+
- [New to hooks?](#new-to-hooks)
21+
- [Introduction to Custom Hooks](#introduction-to-custom-hooks)
2022
- [Building an animation custom hook](#building-an-animation-custom-hook)
2123
- [Custom hooks and refs](#custom-hooks-and-refs)
2224
- [When is my hook invoked?](#when-is-my-hook-invoked)
@@ -571,6 +573,33 @@ const withClapAnimation = WrappedComponent => {
571573
572574
## **Section 3: Custom Hooks: The first Foundational Pattern**
573575
576+
### New to hooks?
577+
578+
- [Hooks API Reference](https://reactjs.org/docs/hooks-reference.html)
579+
580+
Basic Hooks
581+
- [Using the State Hook](https://reactjs.org/docs/hooks-state.html)
582+
- [Using the Effect Hook](https://reactjs.org/docs/hooks-effect.html)
583+
- [useContext](https://reactjs.org/docs/hooks-reference.html#usecontext)
584+
585+
Additional Hooks
586+
- [useCallback](https://reactjs.org/docs/hooks-reference.html#usecallback)
587+
- [useMemo](https://reactjs.org/docs/hooks-reference.html#usememo)
588+
- [useRef](https://reactjs.org/docs/hooks-reference.html#useref)
589+
- [useLayoutEffect](https://reactjs.org/docs/hooks-reference.html#uselayouteffect)
590+
591+
How do lifecycle methods correspond to Hooks?
592+
- constructor: Function components don’t need a constructor. You can initialize the state in the useState call. If computing the initial state is expensive, you can pass a function to useState.
593+
- getDerivedStateFromProps: Schedule an update while rendering instead.
594+
- shouldComponentUpdate: See React.memo below.
595+
- render: This is the function component body itself.
596+
- componentDidMount, componentDidUpdate, componentWillUnmount: The useEffect Hook can express all combinations of these (including less common cases).
597+
- getSnapshotBeforeUpdate, componentDidCatch and getDerivedStateFromError: There are no Hook equivalents for these methods yet, but they will be added soon.
598+
599+
**[⬆ back to top](#table-of-contents)**
600+
601+
### [Introduction to Custom Hooks](https://reactjs.org/docs/hooks-custom.html)
602+
574603
Custom Hooks are a mechanism to reuse stateful logic
575604
576605
```javascript

0 commit comments

Comments
 (0)