react-window-detect-dimensions

0.2.0 • Public • Published

react-window-detect-dimensions NPM version Dependency Status

React component to detect window size change

Installation

$ npm install --save react-window-detect-dimensions

Usage

class DimensionDemo extends React.Component<{}> {
  render() {
    return (
      <WindowDimensions>
        { ({ windowWidth, windowHeight }) => (
          <div>
            width: {windowWidth}, // get window width
            height: {windowHeight} // get window height
          </div>
        )}
      </WindowDimensions>
    );
  }
}

Start example server

npm start

generate demo

npm run gh-pages

License

MIT © chilijung

/react-window-detect-dimensions/

    Package Sidebar

    Install

    npm i react-window-detect-dimensions

    Weekly Downloads

    70

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    9.19 kB

    Total Files

    5

    Last publish

    Collaborators

    • chilijung