【发布时间】:2021-04-21 07:39:18
【问题描述】:
我正在使用 firebase 登录来登录我的应用。但是当我登录时,我只在第一次登录时收到此错误。如果我关闭并重新打开应用程序,则不会显示此错误。 我的功能是
async function confirmCode() {
try {
await confirm.confirm(code).then((userData) => {
setModalVisible(false);
props.navigation.navigate('mTab', {screen: 'Home'});
setCode('');
ToastAndroid.show('User Signed In !', ToastAndroid.SHORT);
user = {
uid: userData.user.uid,
name: '',
phone: userData.user.phoneNumber,
photoURL: userData.user.photoURL,
fcmToken: token,
};
dispatch(set_user(user));
});
} catch (error) {
ToastAndroid.show('Invalid Code !', ToastAndroid.SHORT);
console.log(error);
}
}
这是调试器中的错误
D:\Native\messengerMuaz\node_modules\react-native\Libraries\Core\ExceptionsManager.js:179 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
【问题讨论】:
-
这只是一个警告。它说它来自一个未在卸载时清理的 useEffect。您必须向我们展示效果。
标签: reactjs react-native react-redux