// create services folder and api file import axios from "axios"; export const api = axios.create({ baseURL: " http://localhost:3333", }); // on the page where the useEffect is located import { api } from "./services/api"; useEffect(() => { async function getData() { const response = await api.get("/episodes"); setData(response.data); } getData(); }, []);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter