Skip to content

useEffect

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

Analog React.useEffect(callback, deps())

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

function Component(props) {
  let dependency = 0

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

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

export default afc(Component)
Clone this wiki locally