React hooks for Axios with built-in react-toastify integration. Version 0.2.13. Active development. Provides a simple hook (useAxiosInterceptor) that returns data, pending state, and an apiHandler function to perform HTTP requests with automatic toast notifications. Requires explicit installation of peer dependencies (axios, react-toastify). Supports bearer token via localStorage and base URL via environment variable (REACT_APP_BASE_URL). Less flexible than alternatives like react-query or swr, but offers minimal configuration for toast integration.
npm install axios-interceptor-hookNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage of useAxiosInterceptor with toast integration and GET request.
Set REACT_APP_BASE_URL in environment file.
localStorage.setItem('authToken', '<YOUR TOKEN>');Set delay to 0 or omit if not needed.
Pass toast options in every apiHandler call.
Check data before rendering (e.g., data && ...).
Run: npm install axios react-toastify axios-interceptor-hook
Use: const { useAxiosInterceptor } = require('axios-interceptor-hook');Set localStorage.setItem('authToken', token);Ensure useAxiosInterceptor() returns object with apiHandler.