UNPKG

@darwish/hooks-core

Version:

11 lines (10 loc) 381 B
import { useEffect } from "react"; import { isFunction, isDev } from "@darwish/utils-is"; export default function useMount(fn) { if (isDev && !isFunction(fn)) { console.error("useMount: parameter `fn` expected to be a function, but got \"".concat(typeof fn, "\".")); } useEffect(function () { fn === null || fn === void 0 ? void 0 : fn(); }, []); }