useSetTimeout

UseSetTimeoutExample

src/prod/events/useSetTimeout.ts

import React from 'react';



export const useSetTimeout = (
	callback: any,
	dependencies: any[] = [],
	timeout = 1000
) => {
	React.useEffect(() => {
		const timeoutId = setTimeout(callback, timeout);
		return () => clearTimeout(timeoutId);
	}, dependencies);
	return 0;
};

dist/prod/events/useSetTimeout.js

import React from 'react';
export const useSetTimeout = (callback, dependencies = [], timeout = 1000) => {
    React.useEffect(() => {
        const timeoutId = setTimeout(callback, timeout);
        return () => clearTimeout(timeoutId);
    }, dependencies);
    return 0;
};

src/prod/events/useSetTimeout.ts

import React from 'react';



export const useSetTimeout = (
	callback: any,
	dependencies: any[] = [],
	timeout = 1000
) => {
	React.useEffect(() => {
		const timeoutId = setTimeout(callback, timeout);
		return () => clearTimeout(timeoutId);
	}, dependencies);
	return 0;
};