I was able to get to the bottom of this problem. I was including axios as import axios from 'src/utils/axios';
which had the following code:
import axios from 'axios';
const instance = axios.create();
export default instance;
so when i changed import axios from 'src/utils/axios'; to import axios from 'axios'; it worked!
What I still don't get is why it didn't work with the previous file? I looked into instances and saw we could define a baseURL which I did and change the code in src/utilis/axios to
import axios from 'axios';
const instance = axios.create({baseURL: process.env.REACT_APP_API_URL});
export default instance;
but it still doesnt work. Could someone please give me an insight on instances and why the above doesnt work