Комментарии:
Nice video, we could've added a "loading..." state as well to show up when there is no data and an API call is pending, like below:
{data && data.length > 0 && listbox(data, activeIndex)}
---> {isLoading && <div>Loading...</div>}
---> {query && !isLoading && data && data.length === 0 && noResultMessage()}
{error && errorMessage()}
Hi
I've not used the lodash debounce but I debounced it using setTimeout in the useEffect
Is this fine?
useEffect(() => {
if (!query) {
setData(null);
setError(null);
return;
}
const controller = new AbortController();
const signal = controller.signal;
const debounce = setTimeout(() => {
fetchData(query, transformData, signal);
}, debounceWait);
return () => {
clearTimeout(debounce);
controller.abort();
};
}, [query, transformData, fetchData, debounceWait]);
return [data, setData, error];
};
i did not understand where did write Abortcontroller code?
ОтветитьThanks brother ❤, for creating such great content.
ОтветитьHow much time do company provide us to solve this problem in real interview?
ОтветитьThanks man, i appreciate your commitment to provide a better content 👏
ОтветитьHey where can i find these questions for interview preperation ?
ОтветитьThanks for the effort boss💙💙🙌🙌
ОтветитьIs this machine coding round ask in every company? Bhai
ОтветитьNext video on Carousel please
ОтветитьGreat video Vedant, have been waiting for this from long time
Ответить