EugeneDz / react-hoc-dimensions

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

Home Page:https://www.npmjs.com/package/react-hoc-dimensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

https://www.npmjs.com/package/react-hoc-dimensions


Languages

Language:JavaScript 100.0%