From 00d1cf0915c0ebf3b1770f7bffc7e71f0052c2c3 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Wed, 23 Mar 2022 18:42:44 -0400 Subject: [PATCH] [18] Add docs for useInsertionEffect --- content/docs/hooks-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/hooks-reference.md b/content/docs/hooks-reference.md index a6fd4c9f2d8..90b7875b847 100644 --- a/content/docs/hooks-reference.md +++ b/content/docs/hooks-reference.md @@ -599,8 +599,8 @@ const selectedField = useSyncExternalStore( useInsertionEffect(didUpdate); ``` -TODO: description +The signature is identical to `useEffect`, but it fires synchronously _before_ all DOM mutations. Use this to inject styles into the DOM before reading layout in [`useLayoutEffect`](#uselayouteffect). Since this hook is limited in scope, this hook does not have access to refs and cannot schedule updates. > Note: -> -> TODO: no refs +> +> `useInsertionEffect` should be limited to css-in-js library authors. Prefer [`useEffect`](#useeffect) or [`useLayoutEffect`](#uselayouteffect) instead.