use-isomorphic-effect

Switch between useEffect during SSR and useLayoutEffect after hydration

Usage

use-isomorphic-effect allows you to switch between useEffect during server side rendering and useLayoutEffect after hydration. Use it wherever you would use useLayoutEffect to avoid warnings during ssr:

import { useIsomorphicEffect } from "@bigcomponents/hooks";
 
function Demo() {
  useIsomorphicEffect(() => {
    document.title = "title";
  });
 
  return null;
}