React HOC that passes browser window size to wrapped component
JavaScript
Switch branches/tags
Nothing to show
Clone or download
finnfiddle Merge branch 'master' of github.com:finnfiddle/react-window-size
* 'master' of github.com:finnfiddle/react-window-size:
  Fix double render
Latest commit 8d834a9 May 4, 2018

README.md

React Window Size

A higher-order React component that passes the browser window's dimensions as props to the wrapped component.

Example:

import React, { Component } from 'react';
import windowSize from 'react-window-size';

class ScreenSize extends Component {

  render() {
    return (
      <p>
        Screen width is: {this.props.windowWidth}
        <br />
        Screen height is: {this.props.windowHeight}
      </p>
    );
  }

}

export default windowSize(ScreenSize);