DEV Community

Discussion on: React: "I really wish this is how I could write components."

sebastienlorber profile image
Sebastien Lorber

Your code is subject to race conditions.


You'd rather use a lib that solves it for you with all the edge cases, like

joelnet profile image
JavaScript Joel Author

Yep this is correct! Any previous fetch needs to be aborted.

Since this code was just for fun, I don't think I'll be spending the time to add these cases into it. But if someone wants to contribute a gist, i'll gladly link it.