Reputation: 16849
Is it already possible to use top-level await in react-native? I saw it's been added to TypeScript 3.8 (I was not using TS, I just tried to see if it would help but no). However in react-native file transform is handled by babel and I don't think the current metro preset handles top-level awaits. Is there any way to make it work?
Upvotes: 18
Views: 1781
Reputation: 701
ECMAScript feature top-level await stands on two conditions:
But React-Native uses node modules, so the answer is no.
See Ecma international standard for more
EDIT:
According to comment and more is possible in Node.js. But React-Native uses V8, which supports it too. It just compiles JSX to C++.
Upvotes: 1