Getting Started with Firebase 9 #6 - Real Time Collection Data

  Рет қаралды 62,821

Net Ninja

Net Ninja

2 жыл бұрын

Hey gang, in this firebase 9 tutorial I'll show you how to setup a real-time subscription to a collection get real-time data, using the onSnapshot method.
🐱‍👤 Course files:
github.com/iamshaunjp/Getting...
🐱‍👤 My Premium Udemy courses:
thenetninja.co.uk/udemy/react...
thenetninja.co.uk/udemy/vue-a...
thenetninja.co.uk/udemy/moder...
thenetninja.co.uk/udemy/d3-an...
🐱‍👤 Get access to all other premium courses on Net Ninja Pro:
netninja.dev/
🐱‍💻 My Social Links:
Facebook - / thenetninjauk
Twitter - / thenetninjauk
Instagram - / thenetninja

Пікірлер: 75
@IvanJuras
@IvanJuras 2 жыл бұрын
Your teaching talent is unprecedented. Thank you so much.
@NetNinja
@NetNinja 2 жыл бұрын
Thank you :)
@ashkanahmadi
@ashkanahmadi 2 жыл бұрын
Great job. I have never used Firebase before but your tutorial is definitely helpful. I love the fact that you aren't rushing through everything and taking your time. Thank you
@andrewclarke6916
@andrewclarke6916 2 жыл бұрын
Thanks for making this short course on the new changes to Firebase 9. I've just started working on a new project that utilises Firebase and this collection of videos is so much easier to follow than wading through the online documentation.
@jakemartin6966
@jakemartin6966 2 жыл бұрын
I NEVER leave comments on YT but this tutorial is seriously awesome! So much better than going through the Firebase documentation.
@duncanhendry6419
@duncanhendry6419 2 жыл бұрын
Thank you very much for releasing this series, it has been a huge help and there doesn't seem to be much info about it at the moment 🙌
@maskman4821
@maskman4821 2 жыл бұрын
Yeah, we can learn the best Firebase courses from Shaun, now the version 9 works much faster than version 8, modular sdk makes bu dle size so small, runs extremely fast, really performance and awesome 🤩
@birarr
@birarr 2 жыл бұрын
Great tutorial's playlist! I'm really getting the point. Thanks!
@bgrand-ch
@bgrand-ch 2 жыл бұрын
Thanks for all your amazing explanations 🙌☺️
@muhammad_abir
@muhammad_abir 2 жыл бұрын
I can't find enough word to say thank you..... I've watched many tutorials about firebase but really I was not able to understand anything! but now I'm able to make firebase crud by myself also I've learned about webpack...... thanks a lot brother shaun.....
@NetNinja
@NetNinja 2 жыл бұрын
Really glad you like them! 😃
@rishadali2866
@rishadali2866 2 жыл бұрын
Thanks Shaun love your content
@KiggunduJude120
@KiggunduJude120 Ай бұрын
This has literally saved my life
@digambernegi2023
@digambernegi2023 2 жыл бұрын
Excellent Playlist. Approved
@tech3425
@tech3425 2 жыл бұрын
Great course! Looking forward to more indepth Firebase 9 courses
@nguyenthiphuong1623
@nguyenthiphuong1623 Жыл бұрын
This is the best course to start to learn firebase, I have try a lots series about this but it doesn't clear like your series. Thank you very much.
@NetNinja
@NetNinja Жыл бұрын
Glad it was helpful!
@sinki3322
@sinki3322 19 күн бұрын
You are absolutely amazing. Thank you for helping us !!
@NetNinja
@NetNinja 18 күн бұрын
Happy to help! :) thanks for such a lovely comment
@sahidulislamjony5769
@sahidulislamjony5769 2 жыл бұрын
I am enjoying this series
@tusharutane8031
@tusharutane8031 Жыл бұрын
Thank you so much I was stuck in my project ☺️ yay I'm so f**** happy
@NetNinja
@NetNinja Жыл бұрын
Glad to hear that Tushar 😊
@programmerrdai
@programmerrdai 2 жыл бұрын
Great Content Keep up the great work :)
@RealSkaarj
@RealSkaarj 11 ай бұрын
Thank you man, that saved me from a lot of frustration with Firebase...
@NetNinja
@NetNinja 11 ай бұрын
Glad I could help!
@jacob_dmn
@jacob_dmn Жыл бұрын
I'm already celebrating the 1M subs, LOVE U
@NetNinja
@NetNinja Жыл бұрын
Aha, thanks Jacob! :)
@edisonmondal2798
@edisonmondal2798 Жыл бұрын
Sir! You have saved my life ❤❤🔥🔥🖤🖤
@Forte96
@Forte96 2 жыл бұрын
Hey there, thanks alot for amazing videos first of all! helped me so much so far. I have question about onSnapshot, do you know why my snapshot triggers twice? even I deleted all my code and did exactly how u did in video but it triggers twice(I get 2 console logs). Thanks in advance!
@IliyaDamyanov
@IliyaDamyanov 4 ай бұрын
Very good video.
@wealthiduwe2817
@wealthiduwe2817 2 жыл бұрын
Thanks so much for this!!! Pls can you help with a tutorial that shows how subcollections can be used and read using firebase9?
@cockapockets
@cockapockets 2 жыл бұрын
i know its not part of the web stack as such but would it be possible for you to do a series on RUST ? i think your teaching style is great and would love to learn rust from your self as the ones that are out there already are not very good at all. excellent channel hope you reach the 1 million mark
@slimyelow
@slimyelow Жыл бұрын
Net Ninja kicka assu!
@mykoexe4135
@mykoexe4135 2 жыл бұрын
AMAZING CONTENT
@generalknowledge6660
@generalknowledge6660 2 жыл бұрын
Thanks 🙏
@tudatostrader
@tudatostrader Жыл бұрын
Can this be done on Realtime Database as well as Firestore? Thanks Shawn!
@muhammadarsallanshahab6760
@muhammadarsallanshahab6760 Жыл бұрын
In react app where should we put our initializeapp function? Is that should in every page where we need to use firebase or just util file
@Omerko
@Omerko 2 жыл бұрын
I thought that you would change DB from Firestore to Real-Time, but using a snapshot is really handy for this.. Nice video.. :D
@maskman4821
@maskman4821 2 жыл бұрын
Socketio is cool too 😎
@tariqsyed6011
@tariqsyed6011 2 ай бұрын
Is it free in Firebase to get real time data
@anonymouspersonal9136
@anonymouspersonal9136 2 жыл бұрын
I'm using react for this tutorial. First I created a new react app then I removed the things which is not necessary. Created all things like you did. The react way. UI is fine. Reset is fine. However when I go to inspect and check the console. It doesn't show me anything. Like the Array it is showing you.
@yousefbaghlaf6713
@yousefbaghlaf6713 8 ай бұрын
Isnt it more expensive to attach a listener than a normal get call?
@mohammedbadah5537
@mohammedbadah5537 2 жыл бұрын
Awesome explanation ...
@joneymiah9014
@joneymiah9014 2 жыл бұрын
will you cover firebase authentication?
@mohamedyoussef8835
@mohamedyoussef8835 2 жыл бұрын
Awesome Tutorial ++++++++++++++++++++ Thank You
@robbyl6863
@robbyl6863 2 жыл бұрын
In React Native / expo. When I set up onSnapshot it just keeps firing over and over, even when nothing is changing. Any ideas?
@amaechinaikechukwu8266
@amaechinaikechukwu8266 2 жыл бұрын
In my project,when data is added and onSnapshot is called, the whole existing data is added to the new data, causing duplicates. Hopefully,you've helped me.
@leonvanrijswijk8409
@leonvanrijswijk8409 2 жыл бұрын
Thanks. Does this 'auto-fetch' also happen if someone on another computer changes the collection?
@NetNinja
@NetNinja 2 жыл бұрын
Yeah, it doesn’t matter who makes the change.
@sagshah10
@sagshah10 2 жыл бұрын
Just wondering, if you had a large collection of data, maybe millions of records, can you control how much of the snapshot you receive? Or would it return the whole collection always. How would you optimize for those scenarios?
@jackknott1993
@jackknott1993 2 жыл бұрын
You can pass through a query instead of a collection ref (built using the collection ref and where/orderBy clauses etc) and I'm guessing it only triggers when something is updated that matches the query
@maskman4821
@maskman4821 2 жыл бұрын
@@jackknott1993 smart move 👌
@xdgogo5231
@xdgogo5231 9 ай бұрын
I did exactly the same thing as in the video and mine is not working. Could you try and help me?
@manoj-k
@manoj-k 2 жыл бұрын
🔥🔥🔥
@Shubham_Patil__
@Shubham_Patil__ Жыл бұрын
Can I use this to render my data in real time? Like if I add or delete something then will it reflect on my page without reloading the page??
@jsricochet
@jsricochet Жыл бұрын
Yes you can :) Following this great tuto, I've done it with React like so: const [technos, setTechnos] = useState([]); const firestore = getFirestore(); const colRef = collection(firestore, 'technos'); useEffect(() => { onSnapshot(colRef, (snapshot) => { console.log('snapshot', snapshot); getTechnos(snapshot); }); }, []); function getTechnos(snapshot) { let result = []; snapshot.docs.forEach((doc) => { result = [...result, { ...doc.data(), id: doc.id }]; }); setTechnos(result); } Then you just have to iterate over the technos array on the view ;)
@nawoditnayan4364
@nawoditnayan4364 2 жыл бұрын
my console page is not updating every time i have refresh the page to see new data
@thaophung9503
@thaophung9503 2 жыл бұрын
mine is doing the same
@Ebuilt
@Ebuilt 11 ай бұрын
Hi, I have followed your tutorial & I am getting data in my window sucessfully. But I am unable to pass this data to other file. When I use hook I got Error. Can you please Let me know the issue
@Ebuilt
@Ebuilt 11 ай бұрын
import firestore from '@react-native-firebase/firestore'; import React, { useEffect, useState } from 'react'; export const UseFetchUserData = () => { const [userData, setUserData] = useState([]); console.log('fire store entry') useEffect(() => { const unsubscribe = firestore() .collection('Users') .onSnapshot(snapshot => { const changes = snapshot.docChanges(); const updatedData = changes.map(change => change.doc.data()); setUserData(updatedData); console.log('Dynamic',updatedData) }, error => { console.log('Error fetching data:', error); }); return () => { // Clean up the subscription when the component unmounts //unsubscribe(); }; }, []); return null; }; This is the file which request data
@heyIappreciateit
@heyIappreciateit 2 жыл бұрын
When is the firebase admin sdk?
@maskman4821
@maskman4821 2 жыл бұрын
Yeah, that is one of my question, nodejs+express/fastify+firebase admin, we have a lot of opportunities to work with firebase in our own backend, you know 😃
@maskman4821
@maskman4821 2 жыл бұрын
Hello, Shaun, is it possible for you to create a series of supabase tutorials? a lot of corps, projects have shifted to supabase and we really need a good tutorial on this cool serverless, I know you are a big fan of firebase, but we have to move on, embracing new technology, anyhow thank you in advance 🙏🙏🙏
@NetNinja
@NetNinja 2 жыл бұрын
I will also be doing a supabase tutorial in the future :)
@maskman4821
@maskman4821 2 жыл бұрын
@@NetNinja that would be awesome 🤩
@danielwatson6529
@danielwatson6529 2 жыл бұрын
I always say "Alright Then Gang" when you do at the start of each vid, I know the starts all off by heart now 😅
@ChandanKumar-of1je
@ChandanKumar-of1je 2 жыл бұрын
@udaykiran4912
@udaykiran4912 2 жыл бұрын
onSnapshot is not working when i add data, changes are not reflected on console
@krzysztofchylinski6252
@krzysztofchylinski6252 Жыл бұрын
same issue, seen others having same on stack overflow, unfortunately i can't find an aswer
@covaciuandrei
@covaciuandrei Жыл бұрын
@@krzysztofchylinski6252 It seems that you need to run the npm run build before because you need to have the watcher on for the changes
@ginichimarugraal8282
@ginichimarugraal8282 Жыл бұрын
@@covaciuandrei thanks buddy u saved me
@covaciuandrei
@covaciuandrei Жыл бұрын
@@ginichimarugraal8282 i never leave comments, but i think i was searching for a solution for half an hour😂😂 You’re welcome bro
@xdgogo5231
@xdgogo5231 9 ай бұрын
@@covaciuandreithank you soo much, I really tought I was missing something, I can't thank you enough
@vhack__4126
@vhack__4126 10 ай бұрын
Bro the same code is not working for me. Its giving this error Expected type 'Query', but it was: a custom CollectionReference object FirebaseError: Expected type 'Query', but it was: a custom CollectionReference object Code: useEffect(() => { const getChats = () => { const unsub = onSnapshot(collection(db, "user"), (snapshot) => { snapshot.docs.forEach((doc) => { console.log("snapshot: ", doc.data()); }); }); }; userState.user.uid && getChats(); }, [userState.user.uid]);
Getting Started with Firebase 9 #7 - Firestore Queries
4:00
Net Ninja
Рет қаралды 57 М.
Getting started with the Firebase Realtime Database on the web
10:18
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,7 МЛН
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 82 МЛН
Did you believe it was real? #tiktok
00:25
Анастасия Тарасова
Рет қаралды 43 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 45 МЛН
Firestore | Realtime updates
11:31
Mafia Codes
Рет қаралды 6 М.
Getting started with Cloud Functions
19:26
Firebase
Рет қаралды 33 М.
React Native Firebase Firestore | Cloud Firestore Database
23:52
Adrian Twarog
Рет қаралды 50 М.
Getting started with Firebase for the web
10:59
Firebase
Рет қаралды 342 М.
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4,7 МЛН