use-axios-client
Basics
Getting Started

TypeScript

You can use TypeScript to get full type safety in your components. use-axios-client ships type definitions, so there's no need to install any @types packages.

# Example

  1. Define your data response shape:
interface Data {
name: string;
age: number;
}
  1. Pass it to a hook:
const { data, error, loading } = useAxios<Data>({
url: 'https://example/api',
});
  1. Get type feedback as you develop:
return <div>{data.location}</div>;
// Property 'location' does not exist on type '{ name: string; age: number; }'