  const [hasError, setHasError] = useState<string>(null);

  const fetch = useCallback(async () => {
    setIsLoading(true);
    setHasError(null);
    const response: HttpResponse<T> = await request();

    if (!response.ok) setHasError(response.parsedBody.error);
    if (response.ok) setData(response.parsedBody);