@inkline/paper
Version:
Paper is a unified interface for defining components for Vue and React using a single code base.
22 lines (17 loc) • 411 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.watch = void 0;
var _react = require("react");
const watch = (dependency, callback) => {
const mounted = (0, _react.useRef)(false);
(0, _react.useEffect)(() => {
if (!mounted.current) {
mounted.current = true;
return;
}
callback(dependency());
}, [dependency()]);
};
exports.watch = watch;