{"size": 413, "ext": "js", "max_stars_repo_path": "client/src/hooks/useIsMobile.js", "max_stars_repo_name": "connect-foundation/2019-09", "max_stars_repo_stars_event_min_datetime": "2019-11-04T03:19:05.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-13T16:11:22.000Z", "max_issues_repo_path": "client/src/hooks/useIsMobile.js", "max_issues_repo_name": "connect-foundation/2019-09", "max_issues_repo_issues_event_min_datetime": "2019-11-07T08:59:15.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T09:57:56.000Z", "max_forks_repo_path": "client/src/hooks/useIsMobile.js", "max_forks_repo_name": "connect-foundation/2019-09", "max_forks_repo_forks_event_min_datetime": "2019-11-12T12:04:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-06T05:35:20.000Z"}
{"max_stars_count": 23, "max_issues_count": 400, "max_forks_count": 8, "avg_line_length": 25.8125, "max_line_length": 51, "alphanum_fraction": 0.7215496368}
import { useEffect, useState } from 'react';
import useInnerWidth from './useInnerWidth';

const useIsMobile = mobileViewBreakpoint => {
  const innerWidth = useInnerWidth();
  const [isMobile, setIsMobile] = useState(
    window.innerWidth < mobileViewBreakpoint,
  );
  useEffect(() => {
    setIsMobile(innerWidth < mobileViewBreakpoint);
  }, [innerWidth]);
  return isMobile;
};

export default useIsMobile;
