package.cjs.react-utils.useUpdateEffect.useUpdateEffect.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = require("react");
var useUpdateEffect = function useUpdateEffect(callback) {
var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var isInitialMount = (0, _react.useRef)(true);
(0, _react.useEffect)(function () {
if (isInitialMount.current) {
isInitialMount.current = false;
return;
}
callback();
}, dependencies);
};
var _default = useUpdateEffect;
exports["default"] = _default;
//# sourceMappingURL=useUpdateEffect.js.map