Socket
Socket
Sign inDemoInstall

@restart/hooks

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/hooks - npm Package Compare versions

Comparing version 0.3.9 to 0.3.10

cjs/useMap.d.ts

15

cjs/useForceUpdate.js

@@ -25,12 +25,9 @@ "use strict";

function useForceUpdate() {
var _useState = (0, _react.useState)(false),
setState = _useState[1]; // The toggling state value is designed to defeat React optimizations for skipping
// updates when they are stricting equal to the last state value
// The toggling state value is designed to defeat React optimizations for skipping
var _useReducer = (0, _react.useReducer)(function (state) {
return !state;
}, false),
dispatch = _useReducer[1];
return (0, _react.useCallback)(function () {
return setState(function (value) {
return !value;
});
}, []);
return dispatch;
}

4

cjs/useMergeState.js

@@ -36,7 +36,7 @@ "use strict";

var nextState = update(state);
return nextState == null ? state : _extends({}, state, nextState);
return nextState == null ? state : _extends({}, state, {}, nextState);
});
} else {
setState(function (state) {
return _extends({}, state, update);
return _extends({}, state, {}, update);
});

@@ -43,0 +43,0 @@ }

@@ -1,2 +0,2 @@

import { useCallback, useState } from 'react';
import { useReducer } from 'react';
/**

@@ -20,12 +20,9 @@ * Returns a function that triggers a component update. the hook equivalent to

export default function useForceUpdate() {
var _useState = useState(false),
setState = _useState[1]; // The toggling state value is designed to defeat React optimizations for skipping
// updates when they are stricting equal to the last state value
// The toggling state value is designed to defeat React optimizations for skipping
var _useReducer = useReducer(function (state) {
return !state;
}, false),
dispatch = _useReducer[1];
return useCallback(function () {
return setState(function (value) {
return !value;
});
}, []);
return dispatch;
}

@@ -31,7 +31,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var nextState = update(state);
return nextState == null ? state : _extends({}, state, nextState);
return nextState == null ? state : _extends({}, state, {}, nextState);
});
} else {
setState(function (state) {
return _extends({}, state, update);
return _extends({}, state, {}, update);
});

@@ -38,0 +38,0 @@ }

{
"name": "@restart/hooks",
"version": "0.3.9",
"version": "0.3.10",
"main": "cjs/index.js",

@@ -16,2 +16,7 @@ "types": "cjs/index.d.ts",

},
"prettier": {
"singleQuote": true,
"semi": false,
"trailingComma": "all"
},
"publishConfig": {

@@ -18,0 +23,0 @@ "access": "public"

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