4 ms·
I feel a bit ignorant, although you don't need to await on assignment, don't you need to await to "unwrap" it when needed?
by rileymat2 6y ago
I feel a bit ignorant, although you don't need to await on assignment, don't you need to await to "unwrap" it when needed?
- thecopy 6y agoSometimes you dont need the result.
- rileymat2 6y agoRight, if you don't need it, you don't need to unwrap it.
- IggleSniggle 6y agoAs the article is making a round-about way of pointing out, you might need to "block" (unwrap) due to a side-effect in order to make the sequencing correct for downstream logic that touches the same thing. Shouldn't be necessary if things are coded appropriately in the first place, and maybe better to just refactor, but...
- hexsprite 6y agoIt’s just a function that returns a promise object. The await keyword triggers the wait and unwrap functionality, but in cases where you don’t care you can just call it as a regular function