Skip to content

๐Ÿ“ A higher-order component that can be used to passing the window dimensions into your component as props.

Notifications You must be signed in to change notification settings

EugeneDz/react-hoc-dimensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

react-hoc-dimensions

A higher-order component that can be used to passing the window dimensions into your component as props.

Installation

npm i --save react-hoc-dimensions

Basic Usage

import React from 'react';
import windowDimensions from 'react-hoc-dimensions';

class Page extends Component {
  render() {
    return (
      <div className="page">
        {this.props.windowWidth < 575
          ? <div> Mobile content </div>
          : <div> Tablet or desktop content </div>
        }
      </div>
    );
  }
}

export default windowDimensions(Page);

Contributing

Pull requests are welcome. You can check that your changes correspond to the code style by running the lint command:

npm run lint

About

๐Ÿ“ A higher-order component that can be used to passing the window dimensions into your component as props.

Resources

Stars

Watchers

Forks

Packages

No packages published