/Advice-generator-app

Challenge from https://www.frontendmentor.io

Primary LanguageHTML

Frontend Mentor - Advice generator app solution

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.

Table of contents

Overview

The challenge

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

Screenshot

Links

My process

Built with

What I learned

I haven't done any Javascript app with API before. This one is my first time using API. After this challenge, I learned how to fetch API in Javascript.

const getAdvice = () => fetch('https://api.adviceslip.com/advice')
	.then(res => {
		return res.json();
	})
	.then(data => {
		console.log(data);
		adviceID.textContent = data.slip.id;
		adviceText.textContent = data.slip.advice;
	})
	.catch(error => console.log("ERROR"))

Continued development

I'll add prograss bar or loading page while the app is waiting for API response.

Useful resources

Author