I admit it, I really have no clue about React. I need to build a small app, so far I could put most pieces together in Expo Snack through research, but now another grinding halt.
export default function App() {
let input = 'xyz';
let output = await decode(input);
return (
<Text>{output}</Text>
)
}
In the main thread I need to make an async call to decode a string. With the above code example I get of course an error App.js: Can not use keyword 'await' outside an async function
.
export const App = async() => {
let input = 'xyz';
let output = await decode(input);
return (
<Text>{output}</Text>
)
}
export default App
Trying to trick it like this gives me just a red warning in the preview: Objects are not valid as a React child (found: [object Promise]).
How can I await? It there a way to make the whole App() function async? Or is there a different way in React?