DEV Community

Cover image for Handle Issue : destroy is not a function. (In 'destroy()', 'destroy' is an instance of Promise)
Asep Septiadi
Asep Septiadi

Posted on

Handle Issue : destroy is not a function. (In 'destroy()', 'destroy' is an instance of Promise)

Cara mengatasi hal ini bisa kita pisah dulu functionnya, lalu kita load pada useEffect();

Error event

Image description

Set new functions

 const setToVarData = async () => { try { setJmlBrand(await AsyncStorage.getItem('JML_DATA_BRAND_LOAD')); setStatusUser(await AsyncStorage.getItem('STATUS_USER')); } catch (error) { Sentry.captureException(error); } }; 
Enter fullscreen mode Exit fullscreen mode

Set in new useEffect

 useEffect(() => { setToVarData(); }, []); 
Enter fullscreen mode Exit fullscreen mode

Sumber Fix Issue: https://medium.com/geekculture/react-uncaught-typeerror-destroy-is-not-a-function-192738a6e79b

Top comments (0)