Random Quote Machine | React

Hi Everyone,
I just completed my Random Quote Machine project
here is the link:

--------- Random Quote Machine -------

thanks for any advice or feedback!
i feel i learned soo much from this project.

Does not pass all tests:

  1. The #quote-box wrapper element should be horizontally centered. Please run tests with browser’s zoom level at 100% and page maximized.

but it passes all the test on phone and tablet

You can actually see it is not centered on a pc. You need to resolve this issue.

1 Like

I want to give you some other feedback regarding your solution.

#1) The following line in your getRandomQuote method has an issue. You are adding 1 to the end, so since the length of the quotes array is 122, your function could return the value 122. Since arrays are zero-indexed, it would return undefined instead of a quote object.

const index = Math.floor(Math.random()*this.state.quotes.length) + 1;

#2) Did you consider having a random quote display when the page first loads instead of just the same first quote of the quotes array? It would be easy to do if you modified your getRandomQuote to accept a quotes argument where you would pass the current value of this.state.quotes to this method. You would have to make a few other minor code changes, but it is quite possible.

#3) You should remove jQuery library from the JS module, because you do not need it using React and it makes the page take longer to load.


Check it again please i tried to fix them :pensive:

Better. Well done. :+1: