import { useRef, useState } from "react"; import AddCompany from "./AddCompanies"; import CompanyTable from "./CompaniesTable"; // @ts-ignore import IconSearch from "../../assets/searchIcon.png"; import { useCompanyData } from "../../Hooks/Companies"; //@ts-ignore import addicon from "../../assets/addiconpng.png"; const theme = localStorage.getItem("theme") === "true" ? true : false; const Company = () => { const [open, setOpen] = useState(false); const showModal = () => { setOpen(true); }; const [search, setSearch] = useState(""); const { data, isLoading, refetch } = useCompanyData({ name: search, is_active: undefined, }); const timerRef = useRef(null); const handleSearchChange = (e: React.ChangeEvent) => { if (timerRef.current) { clearTimeout(timerRef.current); } const searchText = e.target.value; timerRef.current = setTimeout(() => { setSearch(searchText); }, 1000); }; return (
{open && }

Companies

); }; export default Company;