updated state for reflacte immediately update in rendered UI

This commit is contained in:
Pramod Mahajan 2025-05-19 09:47:34 +05:30
parent 49d38f553a
commit 1cac05ddcb

View File

@ -79,7 +79,7 @@ const Directory = () => {
);
};
const filteredContacts = useMemo(() => {
return contacts
return ContatList
.filter((c) => {
const matchesSearch =
c.name.toLowerCase().includes(searchText.toLowerCase()) ||
@ -90,7 +90,7 @@ const Directory = () => {
return matchesSearch && matchesCategory;
})
.sort((a, b) => a.name.localeCompare(b.name));
}, [contacts, searchText, selectedCategoryIds]);
}, [ContatList, searchText, selectedCategoryIds]);
const { currentPage, totalPages, currentItems, paginate } = usePagination(
filteredContacts,
10