@desalegn12
Posted
actually, the error comes from Axios package is not installed from this project as a dependency. so to use Axios you need npm, package.json, or yarn, all in all, any package manager. here is the solution : window.onload = async function () { let advices = await fetch("https://api.adviceslip.com/advice"); advices = await advices.json();
const { slip: { advice, id }, } = advices; //here you can insert id and advice your appropriate place } }
Have fun!
Marked as helpful
@azammustafa66
Posted
Thank you so much Desalegn I'm thinking to use parcel/webpack. @desalegn12