useeffect-factory

0.0.13 • Public • Published

Source code:

import React, {useEffect} from "react";

export const useEffectAsync = (fn, deps) => {
	useEffect(() => {
		fn();
	}, deps);
};

export const useComponentWillMount = (fn) => {
	let ref = useRef(false);

	useEffect(() => {
		if (!ref.current) {
			fn();
			ref.current = true;
		}
	});
};

export const useComponentWillMount2 = (fn) => {
	useEffect(() => {
		fn();
		/* eslint-disable-next-line */
	}, []);
};

/useeffect-factory/

    Package Sidebar

    Install

    npm i useeffect-factory

    Weekly Downloads

    1

    Version

    0.0.13

    License

    MIT

    Unpacked Size

    1.63 kB

    Total Files

    5

    Last publish

    Collaborators

    • sahilrajput03