Skip to content

React HOC that passes browser window size to wrapped component

License

Notifications You must be signed in to change notification settings

finnfiddle/react-window-size

Repository files navigation

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);

About

React HOC that passes browser window size to wrapped component

Resources

License

Stars

Watchers

Forks

Packages

No packages published