This frontend challenge was already completed and sent (that is, it was 100% correct because otherwise it cannot be sent) and now it tells me that I have errors, I do not understand what could have happened, if someone has an answer I would greatly appreciate it
I’m not sure I understand what you mean that “it was 100% correct because otherwise it cannot be sent”. That is not my understanding of how it works. You are expected to confirm that it passes the tests.
Do you this app somewhere where we can see the complete code? An online IDE? A repo?
Hello, thanks to everyone who tried to help me, I already solved the problem and it seems that the url is blocked, I don’t know if it’s the IP of my country or if it’s private, the case is that I already solved it, thank you very much to those who dedicated its time to me
That won’t do what you think it does. The setter returned by setState is asynchronous and won’t update until the next render (if I remember correctly). So, that random that is being used is not the one you just set but is the previous one. To show this, run:
It will work the first time because the quote saved in state matches the quote, but on subsequent calls, they get out of sync. You should either store that number in a local variable or use useEffect to update the quote and author.
Next, you keep doing:
setRandom(Math.floor(Math.random()*(100)))
Do you have 100 quotes? As near as I can tell, you have 102. So, that still “works” but what if the legal team comes back and says that 37 of those quotes have to be removed for legal reasons and some coder removes them but doesn’t change that number - the app will crash. Don’t hard code that in there. You can just use data.quotes.length. And since you do that twice, I’d wrap that in a function.