
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
react-responsive-mixin
Advanced tools
react-responsive-mixin makes building responsive components easy
This mixin adds method called media()
to the react component.
This is a wrapper around enquire.js
this.media(query, handler)
query
query is a media query definition either in string or object format. This mixin internally uses json2mq to convert media query from object to string format.
handler
handler is a function that needs to be executed when media query matches. handler can also be an object according to enquire.js API
var React = require('react');
var ResponsiveMixin = require('react-responsive-mixin');
var Component = React.createClass({
mixins: [ResponsiveMixin],
getInitialState: function () {
return { url: '/img/large.img' };
},
componentDidMount: function () {
this.media({maxWidth: 600}, function () {
this.setState({url: '/img/small.jpg'});
}.bind(this));
this.media({minWidth:601, maxWidth: 1024}, function () {
this.setState({url: '/img/medium.jpg'});
}.bind(this));
this.media({minWidth: 1025}, function () {
this.setState({url: '/img/large.jpg'});
}.bind(this));
},
render: function () {
return <img src={this.state.url} />;
}
});
FAQs
Mixin to develop responsive react components
The npm package react-responsive-mixin receives a total of 1,001 weekly downloads. As such, react-responsive-mixin popularity was classified as popular.
We found that react-responsive-mixin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.