Warning: mkdir(): No space left on device in /var/www/tgoop/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/sWebDev/--): Failed to open stream: No such file or directory in /var/www/tgoop/post.php on line 50
Frontender Libs - обзор библиотек JS / CSS@sWebDev P.4097
SWEBDEV Telegram 4097
Отложенный вызов

Хук useTimeout в React позволяет запускать функцию через заданное время. Полезно для уведомлений, подсказок или отложенных действий.

import { useEffect, useRef } from 'react';

function useTimeout(callback: () => void, delay: number) {
const savedCallback = useRef(callback);

useEffect(() => {
savedCallback.current = callback;
}, [callback]);

useEffect(() => {
if (delay === null) return;
const id = setTimeout(() => savedCallback.current(), delay);
return () => clearTimeout(id);
}, [delay]);
}


Пример
useTimeout(() => setVisible(false), 3000);


👉 @sWebDev
👍2



tgoop.com/sWebDev/4097
Create:
Last Update:

Отложенный вызов

Хук useTimeout в React позволяет запускать функцию через заданное время. Полезно для уведомлений, подсказок или отложенных действий.

import { useEffect, useRef } from 'react';

function useTimeout(callback: () => void, delay: number) {
const savedCallback = useRef(callback);

useEffect(() => {
savedCallback.current = callback;
}, [callback]);

useEffect(() => {
if (delay === null) return;
const id = setTimeout(() => savedCallback.current(), delay);
return () => clearTimeout(id);
}, [delay]);
}


Пример
useTimeout(() => setVisible(false), 3000);


👉 @sWebDev

BY Frontender Libs - обзор библиотек JS / CSS




Share with your friend now:
tgoop.com/sWebDev/4097

View MORE
Open in Telegram


Telegram News

Date: |

How to create a business channel on Telegram? (Tutorial) Although some crypto traders have moved toward screaming as a coping mechanism, several mental health experts call this therapy a pseudoscience. The crypto community finds its way to engage in one or the other way and share its feelings with other fellow members. The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. “[The defendant] could not shift his criminal liability,” Hui said. Telegram desktop app: In the upper left corner, click the Menu icon (the one with three lines). Select “New Channel” from the drop-down menu.
from us


Telegram Frontender Libs - обзор библиотек JS / CSS
FROM American