{"size": 657, "ext": "js", "max_stars_repo_path": "src/hooks/useIsomorphicLayoutEffect.js", "max_stars_repo_name": "galexandrade/react-menu", "max_stars_repo_stars_event_min_datetime": "2020-09-30T08:35:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T21:50:55.000Z", "max_issues_repo_path": "src/hooks/useIsomorphicLayoutEffect.js", "max_issues_repo_name": "galexandrade/react-menu", "max_issues_repo_issues_event_min_datetime": "2020-10-11T06:27:21.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T00:09:39.000Z", "max_forks_repo_path": "src/hooks/useIsomorphicLayoutEffect.js", "max_forks_repo_name": "galexandrade/react-menu", "max_forks_repo_forks_event_min_datetime": "2020-10-12T00:40:57.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T09:27:18.000Z"}
{"max_stars_count": 601, "max_issues_count": 299, "max_forks_count": 37, "avg_line_length": 41.0625, "max_line_length": 130, "alphanum_fraction": 0.7823439878}
import { useEffect, useLayoutEffect } from 'react';

// Get around a warning when using useLayoutEffect on the server.
// https://github.com/reduxjs/react-redux/blob/b48d087d76f666e1c6c5a9713bbec112a1631841/src/utils/useIsomorphicLayoutEffect.js#L12
// https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
// https://github.com/facebook/react/issues/14927#issuecomment-549457471

const useIsomorphicLayoutEffect =
  typeof window !== 'undefined' &&
  typeof window.document !== 'undefined' &&
  typeof window.document.createElement !== 'undefined'
    ? useLayoutEffect
    : useEffect;

export { useIsomorphicLayoutEffect as useLayoutEffect };
