Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-responsive-mixin

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-responsive-mixin

Mixin to develop responsive react components

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
605
decreased by-59.29%
Maintainers
1
Weekly downloads
 
Created
Source

react-responsive-mixin

react-responsive-mixin makes building responsive components easy This mixin adds method to the react component called media()

Usage

this.media(query, handler)
query

query can be either a string or object

handler

handler can be either a function or object

Example
var React = require('react');
var ResponsiveMixin = require('react-responsive-mixin');

var Component = React.createClass({
  mixins: [ResponsiveMixin],
  getInitialState: function () {
    return { device: 'small' };
  }
  componentDidMount: function () {
    this.media({maxWidth: 600}, function () {
      this.setState({device: 'small'});
    }.bind(this));
    this.media({minWidth:600, maxWidth: 1024}, function () {
      this.setState({device: 'medium'});
    }.bind(this));
    this.media({minWidth: 1024}, function () {
      this.setState({device: 'large'});
    }.bind(this));
  }
  render: function () {
    return <div>{this.state.device} </div>
  }
});

Keywords

FAQs

Package last updated on 24 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc