Random Quote please help

Hi,

I am new to web development and i have gone through the FCC curriculum up till the front end library certifications.. Just started the front end library projects

I am currently stuck on how to generate random quotes. I looked through the forum and it seems a lot of people are using JSON/APIs etc.

I have not seen this covered so far in the curriculum (i have done the curriculum up till front end libraries). Am i missing something?

You are correct, using an API has not been covered yet at this point.

You can use a static file with quotes (like an array of quote objects) if you search the net you can find them, there are some on GitHub for example.

Or you can try to learn a bit about using an API and using fetch.



Thanks a lot! Do we need to use react as the projects are under front end library certification?

You do not have to use any libraries or frameworks, but you are strongly encouraged to, so you can learn more about them.

Not all libraries/frameworks may work equally well for the tests I believe, so I’d suggest using React, it is also almost a must-have skill at this point to know at least some React for front-end development.

1 Like

Hi @Layooo

I think the best way to go first and understand how to generate your quotes, will be doing it with pure vanilla js.

  1. Working locally by creating a JSON File. (will contain all an array of quotes: ex: Quote: and Author ).

  2. Once you manage to do it locally you can, do two things.
    a. new XMLHttpRequest(); (old way).
    https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
    b. Fetch() .then()
    https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

  3. This you can do them locally first.

  4. Then you can do API’s from an external link,

  5. Then lastly you can do a framework, but will be to fully understand the concepts from the grass roots, thats how i learn, what really its happening.

Hope this helps :slight_smile:

1 Like