
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-media-hoc
Advanced tools
This projects provides a simple and straight forward method for a React application to adopt and respond to browser media. Most of the time adding media queries to project's CSS is the right way to go. However there are times when an application component needs to detect the resolution of a media device or respond to a change to media/device orientation. This simple Higher Order Component helps you to do just that.
npm install react-media-hoc --save
or
yarn add react-media-hoc
import responsiveToMedia from 'react-media-hoc'
// A simple stateless component will do
const MyResponsiveComponent = ({portrait, mobile}) => (
<div>
{
portrait && <p>You are in portrait mode</p>
}
{
mobile && <p>You are on mobile device</p>
}
</div>
)
export default responsiveToMedia({
portrait: '(orientation: portrait)',
mobile: { maxWidth: 300 }
})(MyResponsiveComponent)
responsiveToMedia call accepts an object with a list of media queries to monitor.
The keys of the object denote the props that will be passed to wrapped component
(MyResponsiceComponent in the example above) and the value of those props will be a boolean
corresponding to the media query matching or not.
The media query can be expressed as a string or as an object which will be parsed using json2mq.
FAQs
React HOC for media queries
The npm package react-media-hoc receives a total of 4 weekly downloads. As such, react-media-hoc popularity was classified as not popular.
We found that react-media-hoc 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.