Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 311 Bytes

use-initial-render.md

File metadata and controls

15 lines (11 loc) · 311 Bytes

useInitialRender

Returns a boolean indicating whether this render tick is the initial one.

Example

const isInitialRender = useInitialRender();

useEffect(() => {
  if (isInitialRender) {
    console.log('this is the first render for this component');
  }
}, [/* effect dependencies */]);