Socket
Book a DemoInstallSign in
Socket

use-responsive-viewport

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-responsive-viewport

Just put `useResponsiveViewport()` in your code and you won't have to think about narrow devices anymore!

0.0.8
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

use-responsive-viewport

Just put useResponsiveViewport() in your code and you won't have to think about narrow devices anymore!

  • Super lightweight: less than 1KB, no dependencies.
  • React Hooks: easy to use.
  • Simple design: just put 1 line into your code.
  • Written in TypeScript: has type definition naturally.

Install

$ yarn add use-responsive-viewport

or

$ npm install --save use-responsive-viewport

Usage

import React from "react"
import { useResponsiveViewport } from "use-responsive-viewport"

const App = () => {
  useResponsiveViewport() // just put this line!

  return <YourApp />
}

API

ParamTypeRequiredDefaultNotes
minWidthnumber (px)false360Fix the screen width from.

Example

useResponsiveViewport(375)

or

PropTypeRequiredDefaultNotes
delaynumber (ms)false200Seconds of debounce. Smaller values result in worse performance.
minWidthnumber (px)false360Fix the screen width from.

Example

useResponsiveViewport({ delay: 350, minWidth: 375 })

License

MIT

TODO

  • Write tests.

Keywords

react

FAQs

Package last updated on 15 Aug 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.