Dan Abramov
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
content/docs/hooks-faq.md
|
|
@ -441,7 +441,7 @@ function Form() { |
|
|
|
const [text, updateText] = useState(''); |
|
|
|
const textRef = useRef(); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useMutationEffect(() => { |
|
|
|
textRef.current = text; // Write it to the ref |
|
|
|
}); |
|
|
|
|
|
|
@ -482,7 +482,7 @@ function useEventCallback(fn, dependencies) { |
|
|
|
throw new Error('Cannot call an event handler while rendering.'); |
|
|
|
}); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useMutationEffect(() => { |
|
|
|
ref.current = fn; |
|
|
|
}, [fn, ...dependencies]); |
|
|
|
|
|
|
|