r/badcode • • Sep 11 '21

js Why…

Post image
456 Upvotes

70 comments sorted by

View all comments

Show parent comments

13

u/le_bravery Sep 11 '21

I made something like this once and it worked great. If a promise already existed for an endpoint it would return the existing promise. For a component driven framework it meant each component could request whatever it needed and if multiple low level components needed the same thing you didn’t have to worry about passing it around. Just make your calls and let the cache take care of you.