Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Advice Generator Solution using React Js

Adhiā€¢ 240

@Adhi-S12

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please provide some feedback.. :)

Community feedback

Melwynā€¢ 250

@melwynt

Posted

Hi there!

Good job on the design.

For the quotes, you might want to use those symbols instead to respect the design: Reversed Double Prime Quotation Mark

The dice button is not working. I also used React for this project. Please feel free to check my solution here.

I think you are facing the same issue that I had. Fetch (or Axios) is caching the data. Because of this it will always return the same value. To overcome this, the URL needs to be always different. This can be done by inserting a timestamp in the url. Here's an example with Axios:

const getData = async () => {
    const url = 'https://api.adviceslip.com/advice';

    const data = await axios.get(`${url}?timestamp=${new Date().getTime()}`);

    setAdvice(data.data.slip);
  };

All the best!

Marked as helpful

0

Adhiā€¢ 240

@Adhi-S12

Posted

@melwynt Hello, Thanks for the input, I was planning to add Reversed Double Prime Quotation Mark but forgot to add it at the end. I just checked now, the dice button is working. In the Api docs it is mentioned that Advice response is cached for 2 seconds. Any repeat-request within 2 seconds will return the same piece of advice. Thanks for the timestamp tip, I'll try it in the project.

0
Shashree Samuelā€¢ 9,260

@shashreesamuel

Posted

Hey, good job completing this challenge, keep up the good work

Your solution looks great however I think the green dice needs some margin from top using margin-top

I hope this helps

Cheers Happy coding šŸ‘

Marked as helpful

0

Adhiā€¢ 240

@Adhi-S12

Posted

@TheCoderGuru Yes the margin needs to be updated, thanks for the response

0

Please log in to post a comment

Log in with GitHub
Discord logo

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