Skip to content

useLayoutEffect

Александр edited this page Jan 17, 2023 · 1 revision
export function useLayoutEffect(callback: React.EffectCallback, deps?: () => React.DependencyList): void

Analog React.useLayoutEffect(callback, deps())

import { afc, useLayoutEffect } from 'react-afc'

function Component(props) {
  let dependency = 0

  useLayoutEffect(() => {
    // any actions
  }, () => [dependency])

  return () => {/*...*/}
}

export default afc(Component)
Clone this wiki locally