useSetInterval

UseSetIntervalExample

src/prod/events/useSetInterval.ts

import React from 'react';



export const useSetInterval = (
	callback: any,
	dependencies: any[] = [],
	duration = 1000
) => {
	React.useEffect(() => {
		const intervalId = setInterval(callback, duration);
		return () => clearInterval(intervalId);
	}, dependencies);
	return 0;
};

dist/prod/events/useSetInterval.js

import React from 'react';
export const useSetInterval = (callback, dependencies = [], duration = 1000) => {
    React.useEffect(() => {
        const intervalId = setInterval(callback, duration);
        return () => clearInterval(intervalId);
    }, dependencies);
    return 0;
};

src/prod/events/useSetInterval.ts

import React from 'react';



export const useSetInterval = (
	callback: any,
	dependencies: any[] = [],
	duration = 1000
) => {
	React.useEffect(() => {
		const intervalId = setInterval(callback, duration);
		return () => clearInterval(intervalId);
	}, dependencies);
	return 0;
};