Skip to content

zangrafx/isMobileDecorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

isMobileDecorator

ES7 Decorator, adds "isMobile" prop to React Component.

Usage

@isMobile()

or

@isMobile(breakpoint)

where breakpoint is number, default 768

example:

import React, { Component } from 'react';
import { isMobile } from 'isMobileDecorator';

@isMobile(640)

class Example extends Component {
  render () {
    // following prop is awailable:
    //  `isMobile`  : true/false

    return <div>
      {this.props.isMobile && (
        <p>Only in mobile!</p>
      )}
    </div>;
  }
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published