@react-hookz/web
Version:
React hooks done right, for browser and SSR.
17 lines (16 loc) • 459 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useMountEffect = void 0;
var react_1 = require("react");
/**
* Run effect only when component is first mounted.
*
* @param effect Effector to run on mount
*/
function useMountEffect(effect) {
(0, react_1.useEffect)(function () {
effect();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
exports.useMountEffect = useMountEffect;