This is a solution to the Advice generator app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Generate a new piece of advice by clicking the dice icon
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- Data from API
function fetchNewAdvice() {
fetch("https://api.adviceslip.com/advice")
.then((response) => response.json())
.then((data) => {
const advice = data.slip.advice;
contentElement.textContent = "\"" + advice + "\"";
const id = data.slip.id;
slipid.textContent = "advice #" + id
})
.catch((error) => {
console.log("Error fetching data:", error);
});
}
This is my first project using API data and it is only a newbie level challenge. I hope to take on harder and more complex projects using APIs before I begin my react tutorial for solid background
- Frontend Mentor - @lamba01
- Twitter - @lambacodes
I thank myself for not giving up despite the difficulties learning from Nigeria.