0.0.3 • Published 5 years ago

hook-usewindowwidth v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

This react hook exposes the current window width to our react component. It also considers window resizing.

Installation

npm install hook-usewindowwidth

Example

import React from 'react';
import ReactDOM from 'react-dom';
import useWindowWidth from 'hook-usewindowwidth';

const DisplayWindowWidth = () => {
    const windowWidth = useWindowWidth();
    return (
      <p>The current window width is {windowWidth}</p>
    )
}

ReactDOM.render(<DisplayWindowWidth />, rootElement);

Requirements

This hook requires React 16.8.0 or higher. As a result React 16.8.0 is also a peer dependency of this package.

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago