'How to create axios interceptors in a separate file in ReactJS

I would like to put my interceptors in a separate file instead of the default App.js so it's easier to manage and so I can keep my App.js file cleaner.
However I can't figure out how to achieve this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source