Open zyuan8591 opened 1 year ago
ref:取得對應資料庫位址 onValue:資料有變更時會執行 cb
const db = getDatabase(app); const starCountRef = ref(db, `users/${userInfo.uid}`); onValue(starCountRef, (snapshot) => { const data = snapshot.val(); console.log(data); });
set:更新對應位址資料
const updateUserInfo = () => { set(ref(db, "users/" + userInfo.uid), { username: userInfo.name, email: "kk@test.com", // profile_picture: userInfo.photo, }); };
getValue
ref:取得對應資料庫位址 onValue:資料有變更時會執行 cb
updateValue
set:更新對應位址資料