Skip to content

Tag: promise

Multithreading with javascript promises

Just learning promises. Javascript is single threaded right? So when it uses fetch api to make http requests it all happens in one thread? How does it manage concurrency with PromisePool then? Then two then above cannot run on multiple threads right? Just in one thread? Thanks Answer Javascript is single thre…

How can I wait until the functions finish in Reactjs?

Hi I am new to reactjs and I am trying to build button with a function doing some calculation by Reactjs. The logic is, first I will get two lists from database by two functions. After these 2 functions return results and setState, the calculate function will continue and do its job. But somehow the state is …

Why is this promise returning undefined?

I am trying to write a simple function like this and I have made a firebase helper like this however, league is logging out as undefined and in here is logging out second. however, I thought it would be the other way around? I thought it would “await” for this function to resolve then once it&#821…