Home / File/ use-mobile.ts — ui Source File

use-mobile.ts — ui Source File

Architecture documentation for use-mobile.ts, a typescript file in the ui codebase. 1 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  e80c5e72_45e0_4456_ae4f_11c6734d40c3["use-mobile.ts"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  e80c5e72_45e0_4456_ae4f_11c6734d40c3 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  style e80c5e72_45e0_4456_ae4f_11c6734d40c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as React from "react"

export function useIsMobile(mobileBreakpoint = 768) {
  const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)

  React.useEffect(() => {
    const mql = window.matchMedia(`(max-width: ${mobileBreakpoint - 1}px)`)
    const onChange = () => {
      setIsMobile(window.innerWidth < mobileBreakpoint)
    }
    mql.addEventListener("change", onChange)
    setIsMobile(window.innerWidth < mobileBreakpoint)
    return () => mql.removeEventListener("change", onChange)
  }, [mobileBreakpoint])

  return !!isMobile
}

Subdomains

Functions

Dependencies

  • react

Frequently Asked Questions

What does use-mobile.ts do?
use-mobile.ts is a source file in the ui codebase, written in typescript. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in use-mobile.ts?
use-mobile.ts defines 1 function(s): useIsMobile.
What does use-mobile.ts depend on?
use-mobile.ts imports 1 module(s): react.
Where is use-mobile.ts in the architecture?
use-mobile.ts is located at apps/v4/hooks/use-mobile.ts (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/hooks).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free