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

react-use

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use - npm Package Compare versions

Comparing version 14.1.0 to 14.1.1

14

esm/useToggle.js

@@ -1,14 +0,6 @@

import { useCallback, useState } from 'react';
import { useReducer } from 'react';
var toggleReducer = function (state, nextValue) { return (typeof nextValue === 'boolean' ? nextValue : !state); };
var useToggle = function (initialValue) {
var _a = useState(initialValue), value = _a[0], setValue = _a[1];
var toggle = useCallback(function (nextValue) {
if (typeof nextValue === 'boolean') {
setValue(nextValue);
}
else {
setValue(function (currentValue) { return !currentValue; });
}
}, [setValue]);
return [value, toggle];
return useReducer(toggleReducer, initialValue);
};
export default useToggle;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("react");
var toggleReducer = function (state, nextValue) { return (typeof nextValue === 'boolean' ? nextValue : !state); };
var useToggle = function (initialValue) {
var _a = react_1.useState(initialValue), value = _a[0], setValue = _a[1];
var toggle = react_1.useCallback(function (nextValue) {
if (typeof nextValue === 'boolean') {
setValue(nextValue);
}
else {
setValue(function (currentValue) { return !currentValue; });
}
}, [setValue]);
return [value, toggle];
return react_1.useReducer(toggleReducer, initialValue);
};
exports.default = useToggle;
{
"name": "react-use",
"version": "14.1.0",
"version": "14.1.1",
"description": "Collection of React Hooks",

@@ -49,3 +49,3 @@ "main": "lib/index.js",

"dependencies": {
"@types/js-cookie": "2.2.5",
"@types/js-cookie": "2.2.6",
"@xobotyi/scrollbar-width": "1.9.5",

@@ -100,9 +100,9 @@ "copy-to-clipboard": "^3.2.0",

"eslint-plugin-react-hooks": "3.0.0",
"fork-ts-checker-webpack-plugin": "4.1.2",
"fork-ts-checker-webpack-plugin": "4.1.3",
"gh-pages": "2.2.0",
"husky": "4.2.3",
"jest": "25.2.7",
"husky": "4.2.5",
"jest": "25.3.0",
"jest-localstorage-mock": "2.4.0",
"keyboardjs": "2.5.1",
"lint-staged": "10.1.2",
"lint-staged": "10.1.3",
"markdown-loader": "5.1.0",

@@ -158,3 +158,3 @@ "prettier": "2.0.4",

"volta": {
"node": "10.19.0",
"node": "10.20.0",
"yarn": "1.22.4"

@@ -161,0 +161,0 @@ },

Sorry, the diff of this file is too big to display

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