Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useDeviceOptions

Need to know when you're on the server, in the browser or in react native in your components/hooks?

Features

  • SSR (server side rendering) support
  • TypeScript support
  • Zero dependencies
  • React Native support

Installation

  • using Yarn
yarn add use-device-options
  • using npm
npm i -S use-device-options

Usage

import useDeviceOptions from 'use-device-options';
export const App = () => {

    const {
      isBrowser,
      isServer,
      isNative,
      device, // 'server', 'browser', or 'native'
      canUseWorkers,
      canUseEventListeners,
      canUseViewport,
    } = useDeviceOptions();

}

About

useDeviceOptions: find device info, isBrowser, isServer, isNative, canUseWorkers, canUseEventListeners and canUseViewport

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages