Configuration object for the request
POST request parameters
API endpoint path
Optional
body?: objectOptional request body
An object containing:
// Basic usage with automatic execution
const { data, loading } = usePost({
path: 'users',
body: { name: 'John' }
});
// Manual execution with custom type
interface ApiResponse { id: string; status: string; }
const { sendPostRequest } = usePost<ApiResponse>({
path: 'orders'
});
Custom hook for making POST requests with type safety and state management