Typeahead searchBox in ReactJs | Frontend Machine Coding Question | React Interview Questions

Typeahead searchBox in ReactJs | Frontend Machine Coding Question | React Interview Questions

JsCafe

1 год назад

8,052 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ayush Kushwaha
Ayush Kushwaha - 02.07.2023 22:52

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()}

Ответить
Forestroad08
Forestroad08 - 28.06.2023 16:58

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];
};

Ответить
salauddin
salauddin - 18.06.2023 12:29

i did not understand where did write Abortcontroller code?

Ответить
LOKESH KHATI
LOKESH KHATI - 08.06.2023 17:51

Thanks brother ❤, for creating such great content.

Ответить
Santosh more
Santosh more - 08.06.2023 15:53

How much time do company provide us to solve this problem in real interview?

Ответить
Anand Baraik
Anand Baraik - 08.06.2023 15:04

Thanks man, i appreciate your commitment to provide a better content 👏

Ответить
Vatan Srivastava
Vatan Srivastava - 08.06.2023 10:38

Hey where can i find these questions for interview preperation ?

Ответить
Gautam Suthar
Gautam Suthar - 08.06.2023 08:36

Thanks for the effort boss💙💙🙌🙌

Ответить
Akash patil
Akash patil - 08.06.2023 08:32

Is this machine coding round ask in every company? Bhai

Ответить
NALLAPARAJU AMARESH VARMA
NALLAPARAJU AMARESH VARMA - 08.06.2023 07:48

Next video on Carousel please

Ответить
NALLAPARAJU AMARESH VARMA
NALLAPARAJU AMARESH VARMA - 08.06.2023 07:48

Great video Vedant, have been waiting for this from long time

Ответить