I have a simple translation function that takes one parameter(string) and return string. It works fine when i use like await translation(key) how ever my need it to use it frequently inside in react native component like below
<Text>{tranlate("faqs")}</Text>
Then again somewhere
<Button title={translate("terms")}/>
My question is although its a async function and not trigger without await or then/catch block. What could be other way i can simple use it without await or then/catch because using it like below is not working
<Text>{await translate("faqs")}</Text>
Any help would be really appriciated!Thanks
It's better to create a custom hook which takes
keyas input and return translated key.You shouldn't use
async-awaitin(J|T)SX.CODESANDBOX