From f673d85616b4c24c87287dfe6ba58b7384a3bde1 Mon Sep 17 00:00:00 2001 From: MinYuan Date: Sun, 30 Aug 2020 18:04:03 +0800 Subject: [PATCH] Add `useLayoutEffect` to those hooks with deps (#3232) --- content/docs/hooks-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/hooks-faq.md b/content/docs/hooks-faq.md index 3e9a2d76..2de3ef6b 100644 --- a/content/docs/hooks-faq.md +++ b/content/docs/hooks-faq.md @@ -580,7 +580,7 @@ Depending on your use case, there are a few more options described below. Let's see why this matters. -If you specify a [list of dependencies](/docs/hooks-reference.html#conditionally-firing-an-effect) as the last argument to `useEffect`, `useMemo`, `useCallback`, or `useImperativeHandle`, it must include all values that are used inside the callback and participate in the React data flow. That includes props, state, and anything derived from them. +If you specify a [list of dependencies](/docs/hooks-reference.html#conditionally-firing-an-effect) as the last argument to `useEffect`, `useLayoutEffect`, `useMemo`, `useCallback`, or `useImperativeHandle`, it must include all values that are used inside the callback and participate in the React data flow. That includes props, state, and anything derived from them. It is **only** safe to omit a function from the dependency list if nothing in it (or the functions called by it) references props, state, or values derived from them. This example has a bug: