The frontend application relies on numerous dependencies such as axios to make API requests and react-hot-toast to display error messages. These dependencies are imported into numerous files in the codebase, making any change to these dependencies cumbersome.
Expected
Create a lib directory with methods or classes where the dependencies are imported only once, and an abstraction layer is used, e.g.:
// lib/request.js
import axios from "axios";
// implementation code to make request with axios
// frontend/src/hooks/useFetchKeywords.ts
import request from '../lib/request'
// Use implementation instead of axios directly
Issue
The frontend application relies on numerous dependencies such as
axios
to make API requests andreact-hot-toast
to display error messages. These dependencies are imported into numerous files in the codebase, making any change to these dependencies cumbersome.Expected
Create a lib directory with methods or classes where the dependencies are imported only once, and an abstraction layer is used, e.g.: