我知道我需要使用onSnapshot,但是,我以前尝试过,但它并没有取消订阅。如果您以另一个用户的身份登录并登录,它有时会获得以前登录的用户的配置文件数据,这是一个可怕的错误。我怎样才能订阅userData信息,但当auth状态发生变化时确保它取消订阅呢?因为我每次尝试都失败了。AuthProvider:import { auth, db
To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.Following counts, displayname, image const dataRef = firestore().collection('usernames');
const usersLinks = firestore()