const [clientName, setClientName] = useState('');
const [loading, setLoading] = useState(false);
const { data, isLoading } = useQuery(
['client-list'],
() => {
setLoading(false);
return loadClientList(clientName);
},
{
enabled: loading,
}
);
const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => setClientName(event.target.value);
useDebouncedEffect(
() => {
if (clientName.length >= 2) {
setLoading(true);
}
},
[clientName],
700
);
sendResponse([
'projects' => array_map(array($this->mapperFE, 'mapperProject'), (object)$projects)
]);
$projects = $this->modelProject->getAll($initialData->user_id);
$this->helper->sendResponse(['projects' => array_map(array($this->mapperFE, 'mapperProject'), $projects)]);