Skip to content

subhashishnabajja/react-device-hooks

Repository files navigation

react-device-hooks

NPM JavaScript Style Guide

Install

npm install --save react-device-hooks

Usage

import * as React from "react";

import { useScreen } from "react-device-hooks";

const Example = () => {
  const { width, height, orientation } = useScreen();
  return (
    <div>
      <p>Device width = {width}</p>
      <p>Device height = {height}</p>
      <p>Device orientation = {orientation}</p>
    </div>
  );
};

The useScreen hook return a object, which contains the height, width and orientation angle of the client screen.

License

MIT © subhashishnabajja


This hook is created using create-react-hook.