Solution for advice generator

Solution retrospective
The solution is working locally but on GitHub pages it shows this error:
Uncaught TypeError: Failed to resolve module specifier "axios". Relative references must start with either "/", "./", or "../".
Please log in to post a comment
Log in with GitHubCommunity feedback
- @desalegn12
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
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord