Throttling React JS | useThrotttle | Frontend Interview Questions | React Interview Experience

preview_player
Показать описание
React Interview Questions throttling.

throttle react
react throttle hook
react throttle
react throttle search
react throttle lodash
throttle react
react throttle lodash
react throttle
usethrottle hook react
usethrottle in react
usethrottle react in hindi
usethrottle react js
custom react hook
js throttling
javascript throttling
throttling in javascript
what is throttling in javascript
throttling react interview question
throttling react hook
Комментарии
Автор

Men i search a lot about how to implement Throttle in react js ( js code is easy but main issue comes is rendering effect in react i triead and even chatgpt still i didn't get ) thank you so much for your video 🌏🌏🌏🌏

AdityaParmar-drgu
Автор

Ye debounce se kaafi similar lg rha hai 🤔

Sandeep-zddq
Автор

import { useEffect, useState, useRef } from "react";

export const useThrottle = (value, delay) => {
const [thValue, setThValue] = useState(value);
const flag = useRef(true);
useEffect(() => {
if (flag.current) {
setThValue(value);
flag.current = false;
var timer = setTimeout(() => {
flag.current = true;
}, delay);
}
return () => clearTimeout(timer);
}, [value, delay]);
console.log(thValue);

return thValue;
};

if i give cleanup function in hook then why it is not working and updating the ui

virajshinde
welcome to shbcf.ru