Hi everybody. Currently I’m working on my Random Quote Machine Project from the Front End Libraries section. The instructions can be found here:
And my current attempt (with no CSS yet!) can be found here:
So the first problem I’m having is within the part of the code that is currently commented out. What I want that part of the code to do is ensure that every quote gets displayed before there’s a repeat. When I uncomment, a quote will be displayed, but clicking the button to display the next quote does nothing. I can’t seem to figure out what is going wrong, when I read through it it all seems like it should work to me.
The second problem is I want to make the code more dynamic, so that if I were to add another quote, I wouldn’t have to change anything. This would involve, creating an array that has the number of every index in the array of quotes, which I currently have hard coded as ‘indicesLeft’ in the state. I guess that maybe that whole way of making sure the quotes don’t repeat is incorrect, in which case I guess I would have to start from scratch anyway.
Any help is appreciated, and let me know if I can clarify in any way.