Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 542 Bytes

useIsomorphicLayoutEffect.md

File metadata and controls

24 lines (16 loc) · 542 Bytes

useIsomorphicLayoutEffect

useLayoutEffect that does not show warning when server-side rendering, see Alex Reardon's article for more info.

Usage

import {useIsomorphicLayoutEffect} from 'react-use';

const Demo = ({value}) => {
  useIsomorphicLayoutEffect(() => {
    window.console.log(value)
  }, [value]);

  return null;
};

Reference

useIsomorphicLayoutEffect(effect: EffectCallback, deps?: ReadonlyArray<any> | undefined);