@peersyst/react-hooks
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -0,7 +1,10 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { useState } from "react"; | ||
export default function useControlled(defaultValue, value, onChange) { | ||
var state = useState(defaultValue); | ||
if (value !== undefined) return [value, onChange || function () { | ||
return undefined; | ||
}];else return state; | ||
var _useState = useState(defaultValue), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
state = _useState2[0], | ||
setState = _useState2[1]; | ||
return [value || state, onChange || setState]; | ||
} |
@@ -0,7 +1,10 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { useState } from "react"; | ||
export default function useControlled(defaultValue, value, onChange) { | ||
var state = useState(defaultValue); | ||
if (value !== undefined) return [value, onChange || function () { | ||
return undefined; | ||
}];else return state; | ||
var _useState = useState(defaultValue), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
state = _useState2[0], | ||
setState = _useState2[1]; | ||
return [value || state, onChange || setState]; | ||
} |
@@ -0,7 +1,10 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { useState } from "react"; | ||
export default function useControlled(defaultValue, value, onChange) { | ||
var state = useState(defaultValue); | ||
if (value !== undefined) return [value, onChange || function () { | ||
return undefined; | ||
}];else return state; | ||
var _useState = useState(defaultValue), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
state = _useState2[0], | ||
setState = _useState2[1]; | ||
return [value || state, onChange || setState]; | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,9 +10,13 @@ value: true | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _react = require("react"); | ||
function useControlled(defaultValue, value, onChange) { | ||
var state = (0, _react.useState)(defaultValue); | ||
if (value !== undefined) return [value, onChange || function () { | ||
return undefined; | ||
}];else return state; | ||
var _useState = (0, _react.useState)(defaultValue), | ||
_useState2 = (0, _slicedToArray2["default"])(_useState, 2), | ||
state = _useState2[0], | ||
setState = _useState2[1]; | ||
return [value || state, onChange || setState]; | ||
} |
{ | ||
"name": "@peersyst/react-hooks", | ||
"author": "Peersyst", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "./node/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34792
686