Browse Source

update hooks-faq.md (#2806)

1- Added getDerivedStateFromError lifecycle method to "Do Hooks cover all use cases for classes?"
2- Added getSnapshotBeforeUpdate lifecycle method to "How do lifecycle methods correspond to Hooks?"
main
Muhammad Arslan Sajid 5 years ago
committed by GitHub
parent
commit
69b15a2117
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/docs/hooks-faq.md

4
content/docs/hooks-faq.md

@ -95,7 +95,7 @@ You can't use Hooks *inside* of a class component, but you can definitely mix cl
### Do Hooks cover all use cases for classes? {#do-hooks-cover-all-use-cases-for-classes}
Our goal is for Hooks to cover all use cases for classes as soon as possible. There are no Hook equivalents to the uncommon `getSnapshotBeforeUpdate` and `componentDidCatch` lifecycles yet, but we plan to add them soon.
Our goal is for Hooks to cover all use cases for classes as soon as possible. There are no Hook equivalents to the uncommon `getSnapshotBeforeUpdate`, `getDerivedStateFromError` and `componentDidCatch` lifecycles yet, but we plan to add them soon.
It is an early time for Hooks, and some third-party libraries might not be compatible with Hooks at the moment.
@ -218,7 +218,7 @@ There are a few more heuristics, and they might change over time as we fine-tune
* `componentDidMount`, `componentDidUpdate`, `componentWillUnmount`: The [`useEffect` Hook](/docs/hooks-reference.html#useeffect) can express all combinations of these (including [less](#can-i-skip-an-effect-on-updates) [common](#can-i-run-an-effect-only-on-updates) cases).
* `componentDidCatch` and `getDerivedStateFromError`: There are no Hook equivalents for these methods yet, but they will be added soon.
* `getSnapshotBeforeUpdate`, `componentDidCatch` and `getDerivedStateFromError`: There are no Hook equivalents for these methods yet, but they will be added soon.
### How can I do data fetching with Hooks? {#how-can-i-do-data-fetching-with-hooks}

Loading…
Cancel
Save