Skip to content

moji2002/react-device-detector-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-device-detector

Bare minimum device detector with no dependecy, Renders components based on device

only 498B gziped

Installing

npm install react-device-detector
yarn add react-device-detector

Usage

import {
  AndroidView,
  IOSView,
  MobileView,
  DesktopView,
} from "react-device-detector";

const MyComponent = () => {
  return (
    <>
      <AndroidView>this will only render on android devices</AndroidView>

      <IOSView>this will only render on iOS devices</IOSView>

      <MobileView>this will only render on mobile</MobileView>

      <DesktopView>this will only render on desktop</DesktopView>
    </>
  );
};

without using components

import { isAndroid, isDesktop, isIOS, isMobile } from "react-device-detector";

const MyComponent = () => {
  if (isMobile) return <p>this will only render on mobile</p>;
  return <p>this will only render on desktop</p>;
};

Contributing

If you have any new suggestions, new features, bug fixes, etc. please contribute by raising pull

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published