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

reshow-hooks

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reshow-hooks - npm Package Compare versions

Comparing version 0.17.51 to 0.17.52

19

build/cjs/useRefUpdate.js
"use strict";
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _react = require("react");
var _callFunc = _interopRequireDefault(require("call-func"));
// @ts-check

@@ -11,12 +13,21 @@

* @param {ValueType|function():ValueType} [value]
* @param {function(ValueType):ValueType} [cookCb]
* @return {React.MutableRefObject<ValueType|undefined>}
*/
var useRefUpdate = function useRefUpdate(value) {
var useRefUpdate = function useRefUpdate(value, cookCb) {
if (cookCb === void 0) {
cookCb = function cookCb(v) {
return v;
};
}
var last = /** @type any*/(0, _react.useRef)();
if (last.current !== value) {
last.current = value;
var lastCook = /** @type any*/(0, _react.useRef)();
var nextValue = (0, _callFunc["default"])(value);
if (last.current !== nextValue) {
last.current = nextValue;
lastCook.current = (0, _callFunc["default"])(cookCb, [value]);
}
return last;
return lastCook;
};
var _default = exports["default"] = useRefUpdate;
module.exports = exports.default;
{
"version": "0.17.51",
"version": "0.17.52",
"name": "reshow-hooks",

@@ -4,0 +4,0 @@ "repository": {

@@ -5,4 +5,5 @@ export default useRefUpdate;

* @param {ValueType|function():ValueType} [value]
* @param {function(ValueType):ValueType} [cookCb]
* @return {React.MutableRefObject<ValueType|undefined>}
*/
declare function useRefUpdate<ValueType>(value?: ValueType | (() => ValueType)): import("react").MutableRefObject<ValueType>;
declare function useRefUpdate<ValueType>(value?: ValueType | (() => ValueType), cookCb?: (arg0: ValueType) => ValueType): import("react").MutableRefObject<ValueType>;

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