Is using componentDidMount()
as an async function good practice in React Native or should I avoid it?
I need to get some info from AsyncStorage
when the component mounts, but the only way I know to make that possible is to make the componentDidMount()
function async.
async componentDidMount() {
let auth = await this.getAuth();
if (auth)
this.checkAuth(auth);
}
Is there any problem with that and are there any other solutions to this problem?