-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (20 loc) · 614 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict";
var _require = require('react'),
useRef = _require.useRef;
function useProperty(prop) {
var propInstance = useRef(prop);
propInstance.current = prop;
return useRef(typeof prop === 'function' ? function () {
return propInstance.current.apply(propInstance, arguments);
} : prop).current;
}
function useProperties() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
return properties.map(useProperty);
}
module.exports = {
useProperty: useProperty,
useProperties: useProperties
};