Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.34 KB

README.md

File metadata and controls

36 lines (27 loc) · 1.34 KB

React Window Bigness 📏

npm Build Status code style: prettier Netlify Status Greenkeeper badge

Performantly pass window dimensions as props! 📐

Render Props Usage:

import * as React from 'react';
import { WindowSize } from 'react-window-bigness';

const MyComponent = () => (
  <WindowSize>
    {({ windowWidth, windowHeight }) => JSON.stringify({ windowWidth, windowHeight })}
  </WindowSize>
);

export default MyComponent;

HOC Usage:

import * as React from 'react';
import { withWindowSize } from 'react-window-bigness';

const MyComponent = ({ windowWidth, windowHeight }) => (
  JSON.stringify({ windowWidth, windowHeight })
);

export default withWindowSize(MyComponent);