🔒 Closed Tanong - regarding ASYNC in REACT JS

Status
Not open for further replies.

Ze_Ro

Forum Guru
good day po .. tanong ko lang po ..

ano po bang ibig sabihin ng ASYNC po dito ? \

JavaScript:
const fetchUsers = async() => {
        const headers = { 'Content-Type': 'application/json' }
        fetch("http://172.12.14.40:4200/allusers", { headers })
        .then(res => res.json())
        .then(resJson => setList(resJson.data))
        .catch(error=>alert(error))
      }

salamat po <3
 
Matagal na ako di naka frontend pero as far as I know...

Di sya specific sa react. Bale return nya is Promise. Di nya agad icall yang URL until icall mo using await.
Pwede mo pag sabayin icall 2 async calls, or in sequence.

let users = await fetchUsers();
 
Matagal na ako di naka frontend pero as far as I know...

Di sya specific sa react. Bale return nya is Promise. Di nya agad icall yang URL until icall mo using await.
Pwede mo pag sabayin icall 2 async calls, or in sequence.

let users = await fetchUsers();
opo .meron ka po await pa yan sa baba ..

salamat po ng maramig sa help
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 403
    Views
  • 2
    Participants
Last reply from:
Ze_Ro

Trending Topics

Online now

Members online
1,062
Guests online
937
Total visitors
1,999

Forum statistics

Threads
2,274,917
Posts
28,959,318
Members
1,233,485
Latest member
senpaikatzu_88
Back
Top