New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-usegetscreen

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-usegetscreen

Hook for determining what screen size you have

latest
Source
npmnpm
Version
1.1.5
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

REACT-USEGETSCREEN

This package provides a hook to provide some functions that you can use to determine the type of screen. Mobile isMobile, Tablet isTablet, Desktop isDesktop

Install
npm install react-usegetscreen --save
yarn add react-usegetscreen
Example
import React, { Component } from "react";
import useGetScreen from "react-usegetscreen";

class Test = () => {
    
    { isMobile, isTablet, isDesktop } = useGetScreen();

    if (isMobile()) return <div>Mobile</div>;
    if (isTablet()) return <div>Tablet</div>;
    return <div>Desktop</div>;
}

export default Test;

It supports an options object containing following props:

  • mobileLimit - Max width for mobile display. default = 468
  • tabletLimit - Max width for tablet display. default=768
  • shouldListenOnResize - Boolean describing whether it should listen on screen resize. default=true

Keywords

react

FAQs

Package last updated on 07 Nov 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