Statements (53)
Predicate | Object |
---|---|
gptkbp:instance_of |
gptkb:Hook
|
gptkbp:belongs_to |
gptkb:React
|
gptkbp:can_be_used_to |
measure the size of an element.
set scroll position. synchronize state with the DOM. trigger re-renders. |
gptkbp:can_cause |
layout thrashing if not used carefully.
|
gptkbp:can_lead_to |
performance issues if overused.
|
gptkbp:data_return |
A cleanup function.
|
gptkbp:description |
A hook that runs synchronously after all DOM mutations.
|
gptkbp:first_argument |
A function that contains imperative, possibly effectful code.
|
https://www.w3.org/2000/01/rdf-schema#label |
use Layout Effect
|
gptkbp:introduced_in |
gptkb:React_16.8
|
gptkbp:is_designed_to |
avoid flickering.
|
gptkbp:is_invoked |
after the DOM has been updated.
before the browser paints. in the order of component hierarchy. in the same phase as the DOM updates. |
gptkbp:is_not_called |
during server-side rendering.
during the initial render. |
gptkbp:is_often_accompanied_by |
use State.
|
gptkbp:is_often_used_in |
CSS transitions.
custom hooks. measure element dimensions. set focus on elements. use Ref. |
gptkbp:is_part_of |
React's Hooks API.
React's functional component paradigm. |
gptkbp:is_similar_to |
use Effect
use Effect but runs synchronously. component Did Mount and component Did Update lifecycle methods. |
gptkbp:is_used_for |
animations.
measuring DOM elements. preventing flicker. synchronizing animations. synchronizing state with the DOM. updating the layout. |
gptkbp:is_used_to |
ensure layout consistency.
perform DOM measurements. perform side effects. |
gptkbp:known_as |
after all DOM mutations.
after the DOM has been painted. after the DOM has been updated. after the component has rendered. after the render phase. before the browser repaints. |
gptkbp:requires |
React version 16.8 or higher.
|
gptkbp:second_argument |
An array of dependencies.
|
gptkbp:suitable_for |
data fetching.
long-running operations. simple state updates. |
gptkbp:usage |
Used to read layout from the DOM and synchronously re-render.
|
gptkbp:was_executed_by |
before the browser has a chance to paint.
|