New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-window-size-hook

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-window-size-hook

A React hook that re-renders a component when the browser window is resized.

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

React Window Size Hook

A React hook that re-renders a component when the browser window is resized.

Usage

import React from 'react';
import { useWindowSize } from 'react-window-size-hook';

function MyComponent() {
  const [width, height] = useWindowSize();

  return (
    <div>
      Window width is {width}px and height is {height}px
    </div>
  )
}

It's pretty straightforward - it takes no arguments and returns an array containing the dimensions of the window. Bam. Done.

Live testing

The root of this project has been created using create-react-app, and it's an app that simply displays the window dimensions. To run it:

npm start

Unit Testing

npm test

Who did this?

Carlos Zanella. I'll update this with a link to my online portfolio as soon as it's done (don't hold your breath).

License

MIT

FAQs

Package last updated on 13 Apr 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