react-window-size
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/react-window-size package

1.2.2 • Public • Published

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

Package Sidebar

Install

npm i react-window-size

Weekly Downloads

1,355

Version

1.2.2

License

MIT

Unpacked Size

12.4 kB

Total Files

8

Last publish

Collaborators

  • finnfiddle