UNPKG

rooks

Version:

Essential React custom hooks ⚓ to super charge your components!

21 lines (20 loc) 598 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useDidMount = void 0; var react_1 = require("react"); /** * useDidMount hook * @description Calls a function on mount * * @param {Function} callback Callback function to be called on mount * @see https://react-hooks.org/docs/useDidMount */ function useDidMount(callback) { (0, react_1.useEffect)(function () { if (typeof callback === "function") { callback(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); } exports.useDidMount = useDidMount;