This solution is generated by ChatGPT, correctness is not guaranteed. You might also be able to find a solution fromcommunity posts.
AI solution for React Quiz on BFE.dev
23. Suspense 3
The code outputs:
1
3
Uncaught (in promise) Promise {<pending>}
The console.log(1)
inside component A
is executed synchronously and logs 1
. Then const memoed
is defined using useMemo
and since there are no dependencies, it is executed immediately and logs 2
. However, the console.log(3)
statement is not executed yet because the get
method of resource
is called and it throws a promise, causing the component to suspend rendering. The promise is logged as Uncaught (in promise) Promise {<pending>}
.