Skip to content

Files

Latest commit

192c983 Β· Jul 10, 2019

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);