DEV Community 👩‍💻👨‍💻

Discussion on: Pro tip: using Promise.then for function composition

Collapse
 
pichardoj profile image
J. Pichardo

I mean that each time you chain a function using then that function is added to the queue which means that it will wait for at least a tick to be called, my only concern is if during that tick a variable, that one of the callbacks relies on, is modified. Maybe is not a pressing matter, just a concern I have.

Nice post tho.

Thread Thread
 
justsml profile image
Daniel Levy

@Pichardo Promises resolve only once, and their value is immutable. And in a functional promise chains each step results in a read-only state.