JSPM

  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q50779F
  • License MIT

Resolves to useEffect when window is not in scope and useLayout effect in the browser

Package Exports

  • @rooks/use-isomorphic-effect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rooks/use-isomorphic-effect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rooks/use-isomorphic-effect

TitleCard

Build Status

About

A hook that resolves to useEffect on the server and useLayoutEffect on the client.

Installation

npm install --save @rooks/use-isomorphic-effect

Importing the hook

import useIsomorphicEffect from "@rooks/use-isomorphic-effect"

Usage

function Demo() {
  useIsomorphicEffect( () => {
    console.log("Effect")
  } ,[]);
  return null
}

render(<Demo/>)