Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-typed-hooks/use-window-size

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-typed-hooks/use-window-size

React hook written in TypeScript

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

useWindowSize

React hook that returns the window size. Updates on window resize and orientation change.

version

Installation

npm install @react-typed-hooks/use-window-size

Usage

import { useWindowSize } from "@react-typed-hooks/use-window-size";

const Demo = () => {
  const size = useWindowSize();

  return size ? (
    <pre>JSON.stringify(size, null, 4)</pre>
  ) : (
    <span>Size is null in a node like environment</span>
  );
};

API

Types

interface Size {
  height: number;
  width: number;
}

interface UseWindowSizeOptions {
  wait?: number;
}
function useWindowSize(options?: UseWindowSizeOptions): Size | null;

Options

wait

The amount of time to delay updating Size after the orientation changes.

The amount of time to throttle between updating Size when the window is resized.

Keywords

FAQs

Package last updated on 06 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc