Skip to content

Wrapper component that detects window resize and pass down to children

License

Notifications You must be signed in to change notification settings

CannerCMS/react-window-detect-dimensions

Repository files navigation

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

About

Wrapper component that detects window resize and pass down to children

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published