Skip to content

Commit

Permalink
Remove the one-time variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
timdorr committed Nov 22, 2019
1 parent 58ae5ed commit 0f1ab09
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/utils/useIsomorphicLayoutEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import { useEffect, useLayoutEffect } from 'react'
// is created synchronously, otherwise a store update may occur before the
// subscription is created and an inconsistent state may be observed

const isHopefullyDomEnvironment =
export const useIsomorphicLayoutEffect =
typeof window !== 'undefined' &&
typeof window.document !== 'undefined' &&
typeof window.document.createElement !== 'undefined'

export const useIsomorphicLayoutEffect = isHopefullyDomEnvironment
? useLayoutEffect
: useEffect
? useLayoutEffect
: useEffect

0 comments on commit 0f1ab09

Please sign in to comment.