New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-media-query-hoc

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-media-query-hoc - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

10

dist/media-query-provider.js

@@ -21,2 +21,6 @@ 'use strict';

var _shallowequal = require('shallowequal');
var _shallowequal2 = _interopRequireDefault(_shallowequal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -57,3 +61,7 @@

var media = _this.queryMedia(_this.props.queries, {});
_this.setState({ media: media });
// no need to set state when it hasnt changed
if (!(0, _shallowequal2.default)(media, _this.media)) {
_this.setState({ media: media });
}
};

@@ -60,0 +68,0 @@

5

package.json
{
"name": "react-media-query-hoc",
"version": "0.3.3",
"version": "0.3.4",
"description": "A dead simple React Higher Order Component (HOC) that uses context for matching media queries",

@@ -72,4 +72,5 @@ "main": "dist/index.js",

"matchmedia": "^0.1.2",
"prop-types": "^15.5.10"
"prop-types": "^15.5.10",
"shallowequal": "^1.0.2"
}
}
import React from 'react';
import matchMedia from 'matchmedia';
import PropTypes from 'prop-types';
import shallowequal from 'shallowequal';

@@ -52,3 +53,7 @@ const defaultQueries = {

const media = this.queryMedia(this.props.queries, {});
this.setState({ media });
// no need to set state when it hasnt changed
if (!shallowequal(media, this.media)) {
this.setState({ media });
}
}

@@ -55,0 +60,0 @@

@@ -35,3 +35,3 @@ /* eslint-disable */

it('should render not render mobile view after client / server mismatch', () => {
it('should not render mobile view after client / server mismatch', () => {
const values = {

@@ -38,0 +38,0 @@ width: 300,

@@ -71,3 +71,3 @@ /* eslint-disable */

describe('when mobile matches', () => {
context('when mobile matches', () => {
let mobileComponent;

@@ -124,3 +124,3 @@

describe('when rendering server-side', () => {
context('when rendering server-side', () => {
it('should render', () => {

@@ -127,0 +127,0 @@ expect(() => {

Sorry, the diff of this file is not supported yet

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