1.0.4 • Published 3 years ago

@artifak/usewindowsize v1.0.4

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

@artifak/usewindowsize

A React hook that allows you to get the window dimensions within your React component. Returns an object consisting of properties: innerWidth, innerHeight, outerWidth and outerHeight.

Installation

Yarn

yarn add @artifak/usewindowsize

NPM

npm install @artifak/usewindowsize

Usage

import { useWindowSize } from 'artifak';
import { ExampleMobile } from './ExampleMobile';
import { ExampleDesktop } from './ExampleDesktop';

export function Nav() {
  const windowSize = useWindowSize();

  return (
    <>
      {windowSize.innerWidth < 1000 && <ExampleMobile />}
      <ExampleDesktop />
    </>
  );
}
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago