How to set up React with Firebase/Firestore v9 (Part 2 | addDoc)

  Рет қаралды 20,773

RavenJS

RavenJS

Күн бұрын

Пікірлер: 89
@biradon4444
@biradon4444 Жыл бұрын
Thank you so much for your video, this is straight forward and easy for beginner like me to make my first step to connect React website with the database
@conorcoder7196
@conorcoder7196 Жыл бұрын
Wow, these videos have saved me tonight. Thank you!
@tiedsergosu7715
@tiedsergosu7715 3 жыл бұрын
Bro don't be lazy, these tutorials are what can make your channel explode. Keep making them, we're waiting for the sequels! Great content.
@ravenjs
@ravenjs 3 жыл бұрын
thanks @Sergosu! more will be coming this weekend :)
@hooho491
@hooho491 11 ай бұрын
this is my first time learning firebase, you explained everything very well, thank you so much!
@rajthapa9006
@rajthapa9006 2 жыл бұрын
you have the greatest firebase videos. other videos on youtube are outdated yours is the one working for me
@ADIYR
@ADIYR 2 жыл бұрын
always find a solution if you go to this channel, thank you bro, success always
@danielodiase6824
@danielodiase6824 3 жыл бұрын
I never comment on anything on youtube but youtube needs to make your page bigger . ive been looking for an uptodate firestore video and this video helped me so much . Keep on going .Thanks !
@ravenjs
@ravenjs 3 жыл бұрын
thank you so much @Daniel
@joel_mathew
@joel_mathew 3 жыл бұрын
Dude this is fire🔥🔥🔥🔥🔥 I was looking for a firebase firestore tutorial that is precise, up to date, simple to follow, and not 3 hours long and God blessed me with this firestore series please make content like this. Congratulations!!👏👏👏👏 You have earned a new subscriber.😃😃😃
@ravenjs
@ravenjs 3 жыл бұрын
@Overnight Creator this is amazing HAHA thank you so much for the praise, so happy to hear this :))
@MrCuteguylol
@MrCuteguylol 3 жыл бұрын
Holy shit this channel is a life saver for new users trying to use firebase v9!
@ravenjs
@ravenjs 3 жыл бұрын
Haha thank you @Asad
@MrCuteguylol
@MrCuteguylol 3 жыл бұрын
@@ravenjs thank YOUUUU sir
@suriya7646
@suriya7646 3 жыл бұрын
This was super easy to undestand. Waiting for the next video.
@ravenjs
@ravenjs 3 жыл бұрын
thanks Suri :)
@2029leandro
@2029leandro 3 жыл бұрын
This is so great and easy to understand, and up to date too!
@ravenjs
@ravenjs 3 жыл бұрын
thx 2029leandro :)
@kushalshukla444
@kushalshukla444 3 жыл бұрын
Btw thanks for all , I was stuck in this problem from last 3 days and u sort it .🥂
@ravenjs
@ravenjs 3 жыл бұрын
@kushal that's awesome 😎 let me know whenever you need help next :)
@kushalshukla444
@kushalshukla444 3 жыл бұрын
@@ravenjs 🤜🤛
@rafaelsoteldosilva
@rafaelsoteldosilva 2 жыл бұрын
Hi!. Thank you for these great lessons.
@jeriahcolasino7588
@jeriahcolasino7588 2 жыл бұрын
youre the best dude.
@gauravsaini9186
@gauravsaini9186 3 жыл бұрын
This is just what I needed for help, thank you so much!
@ravenjs
@ravenjs 3 жыл бұрын
I'm glad it helped @Gaurav!
@krishnamuraree2662
@krishnamuraree2662 3 жыл бұрын
Thanks man this video saved my hours😃
@ravenjs
@ravenjs 3 жыл бұрын
that's amazing :))
@IanMont
@IanMont 3 жыл бұрын
Great tutorial!
@ravenjs
@ravenjs 3 жыл бұрын
Thanks Ian xD
@coderchic
@coderchic 3 жыл бұрын
This was super helpful. Thanks!
@ravenjs
@ravenjs 3 жыл бұрын
thank you @Rose!!
@hirosyee
@hirosyee 3 жыл бұрын
Awesome!! I want to see how to get specific document with unknown id, and I hope you have already provided after this lesson. Thanks,
@shaheryartatari864
@shaheryartatari864 2 жыл бұрын
amazing work man.
@catreunion
@catreunion 3 жыл бұрын
thank you so much for giving us a great tutorial!
@lrajoo11
@lrajoo11 3 жыл бұрын
amazing stuff! super clear
@ravenjs
@ravenjs 3 жыл бұрын
thanks! :))
@mcdaddy1334
@mcdaddy1334 3 жыл бұрын
VERY NICE!
@ravenjs
@ravenjs 3 жыл бұрын
THANK YOU :))
@VladiGuitar87
@VladiGuitar87 3 жыл бұрын
Thank you so much for your work! I learn React in a course on udemy and their teach this topic not so well and partially in a deprecated way. Your channel helps me a lot!
@ravenjs
@ravenjs 3 жыл бұрын
Hey @Vladimir I'm flattered haha thank you so much :)
@brendanhurd81
@brendanhurd81 3 жыл бұрын
I have a feeling I have been doing the same course and its been a nightmare.
@VladiGuitar87
@VladiGuitar87 3 жыл бұрын
@@brendanhurd81 haha 🙈 The complete react developer 2021, this one??
@brendanhurd81
@brendanhurd81 3 жыл бұрын
@@VladiGuitar87 Bingo!!!
@magdolnakatay6158
@magdolnakatay6158 3 жыл бұрын
Thank you so much!😲
@ravenjs
@ravenjs 3 жыл бұрын
You're welcome! :))
@arkindustries7347
@arkindustries7347 3 жыл бұрын
Not finished watching but i want to comment first . Thanks in advance . I know its gonna cool 🙂
@ravenjs
@ravenjs 3 жыл бұрын
haha you’re cool too :))))
@arkindustries7347
@arkindustries7347 3 жыл бұрын
@@ravenjs done watching dude, its really cool . And excited again for next . Authentication feature of firebase is i want to learn next and now you implementing it also . Thanks again , Keep it up
@IanMont
@IanMont 3 жыл бұрын
@@arkindustries7347 I also want to learn the auth feature and also implement it with a profile picture uwu
@yashtripathi313
@yashtripathi313 3 жыл бұрын
Really helped!! Thank you for this awesome content @Logicism
@ravenjs
@ravenjs 3 жыл бұрын
thank you Yash!!!!
@henrydj3220
@henrydj3220 3 жыл бұрын
Very easy to follow thanks for the content! LIKE THE VIDEO PPL
@ravenjs
@ravenjs 3 жыл бұрын
YES THX @Henry Dj haHa :)
@Tony-jr3ki
@Tony-jr3ki 3 жыл бұрын
Hey! Great video, thanks. But how can you make colors display in order? And why do they appear the way they do?
@ravenjs
@ravenjs 3 жыл бұрын
Hey Tony! You can definitely make the colors display in order. The catch is that if you want to display the order by creation date, you'll need to create a new field to store the creation date in Firestore and write the logic for that because Firestore doesn't store timestamps by default. Or, if you just want to order the documents by name, you could do something like this: import { collection, query, orderBy, onSnapshot } from "firebase/firestore"; const collectionRef = collection(db, "colors"); const q = query(collectionRef, orderBy("name", "desc")); // Return unsub to useEffect() to terminate listener when unmounting const unsub = onSnapshot(q, (snapshot) => { // snapshot.map( anything in here ) }); In my example there isn't a specific order in which the colors are arranged because I didn't specify an order in the query.
@Tony-jr3ki
@Tony-jr3ki 3 жыл бұрын
@@ravenjs great! Thanks! Looking forward to the next video.
@ЭрикАрутюнян-х1к
@ЭрикАрутюнян-х1к 3 жыл бұрын
Continue I'm waiting for your videos
@ravenjs
@ravenjs 3 жыл бұрын
I will, thx for your encouragement haaha :))
@ЭрикАрутюнян-х1к
@ЭрикАрутюнян-х1к 3 жыл бұрын
@@ravenjs I really waiting)) I have a project to create the Slack clone, you r the one who have updated firebase information
@ravenjs
@ravenjs 3 жыл бұрын
@@ЭрикАрутюнян-х1к sorry have been busy lately but I promise you'll get a new video this weekend :))
@ЭрикАрутюнян-х1к
@ЭрикАрутюнян-х1к 3 жыл бұрын
@@ravenjs Thanks a lot
@oliverblackofficial
@oliverblackofficial 3 жыл бұрын
Hi, cool Video! I have a question. I am using an input field to get the user input and it works fine to add it to a collection. But i takes a few seconds until it renders on my page, do u know why? I am using useState and useEffect the same way u did in your video
@ravenjs
@ravenjs 3 жыл бұрын
hey Oliver! I've noticed that this phenomenon is quite common if you use id=Math.random() in the React component. Are you doing something similar? If not, perhaps you'd like me to take a look at your code for you? You can put a short snippet either here or in pastebin :)
@Froylander
@Froylander 3 жыл бұрын
Hi, how i can add a subcollection ??? i try this code but, i have an error... const collectionRef = collection(db, "chat", userSelected.id); await addDoc(collectionRef, user.id, objMessage); I want to add a document called like the receiver user (userSelected) and inside a subcollect called like the user (me) id, and inside a document with the message.... but I cant :(
@ravenjs
@ravenjs 3 жыл бұрын
could you show me the actual error output message?
@MrFlaviutz
@MrFlaviutz 3 жыл бұрын
Great videos! How can you get data from one document? for me singleData doesnt have the data const singleData = await getDoc(doc(db, method, singleIdentifier)); console.log(singleData)
@ravenjs
@ravenjs 3 жыл бұрын
Your variable 'singleData' only stores the reference to your document in the database. You'll still need to singleData.data() to get the data from the document reference. So it'll be console.log(singleData.data()); Also, you can do singleData.exists() to check if the document exists in the database.
@_MoshikoAz_
@_MoshikoAz_ Жыл бұрын
based on what you've said in this video, is that we don't have to specify an Id property in the collection, since firebase does that automatically for us ?
@MrCuteguylol
@MrCuteguylol 3 жыл бұрын
Hi! I would like some help. Im building an app (POS) on react firebase. I need to do 2 things which im unable to do. First, whenever i push an entry (using form or something) into firebase i need firebase to create an id. (i know it makes u even showed it), but i need that ID dynamically INSIDE my pushed obj like {...obj,id: 'id'} because my issue is that i can't use that auto generated id in my data that i get from server. Secondly i need to perform this authentication. Where whenever i send my data to server, i want that some of my fields should remain unique. I have been trying very hard to do these things but i cant :'(
@ravenjs
@ravenjs 3 жыл бұрын
Hi @Asad, i don't think I understand your first question quite well, could you elaborate on the part about having an ID that is dynamically inside your pushed object? is it that you want to get the ID before pushing the object to the database? also, for the uniqueness constraint, it's a bit more tedious to enforce it with Firestore. Unlike MySQL or Postgres, you'll have to manually perform the uniqueness check with your own code. For example, you could use queries to check if the value already exists in the database
@MrCuteguylol
@MrCuteguylol 3 жыл бұрын
haha actually i saw that u somehow did it yourself (i accidentally missed that part) using doc.id. Second question is a bummer. I dont want my forms to be expensive on the frontend :'(
@ravenjs
@ravenjs 3 жыл бұрын
​@@MrCuteguylol yea it's really a bummer.. :(( i guess having the convenience of not needing to write an API like a rest API or even GraphQL comes at a cost heh worst case scenario: you could try and learn google cloud functions to do some serverless processing but that's a whole new topic
@BillyLegumbres
@BillyLegumbres Жыл бұрын
excuse me I got this error when I try to apply the steps that you show us in this vid "Uncaught (in promise) FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore" and I'm not sure how to get around it
@danielodiase6824
@danielodiase6824 3 жыл бұрын
please make a video where i can get the input to show at the top, preferrably with a timestamp method . Thanks !
@ravenjs
@ravenjs 3 жыл бұрын
do you mean an input field to replace the javascript prompt?
@danielodiase6824
@danielodiase6824 3 жыл бұрын
@@ravenjs I mean just to be able to organize the prompt value based on time stamp . I saw that you covered it in later videos . So this was answered . Thanks for ur hard work
@mageshyt2550
@mageshyt2550 2 жыл бұрын
bro how we can set custom id when we add new doc.
@ravenjs
@ravenjs 2 жыл бұрын
use setDoc instead of addDoc
@mageshyt2550
@mageshyt2550 2 жыл бұрын
@@ravenjs i founded already anyhow thank you so much for your reply 🙂
@mixai7
@mixai7 3 жыл бұрын
how upload photo to firestore ?
@ravenjs
@ravenjs 3 жыл бұрын
for uploading photos, you might have to use cloud storage instead of just cloud firestore :)
@thetransolutions
@thetransolutions 3 жыл бұрын
i want to add with custom id not set. how can i do that
@ravenjs
@ravenjs 3 жыл бұрын
Hi The only way is to use setDoc(), because addDoc() is specifically for if you want Firestore to automatically generate a document ID. Apart from that, setDoc should be able to do everything else if you want to create a new document with it.
@kaushalkumarmishra9201
@kaushalkumarmishra9201 3 жыл бұрын
Plz make admin panel tutorial...
@ravenjs
@ravenjs 3 жыл бұрын
@Kaushal I will! But I think the admin panel will be in its own seperate series. thanks for the suggestion Kaushal
@gigxr
@gigxr 8 ай бұрын
whoever encounters error "Uncaught (in promise) FirebaseError: Missing or insufficient permissions." 1. go to rules in Cloud Firestore 2. in "allow read, write: false" , replace it to allow read, write: if request.auth != null;
@ginvgin
@ginvgin 3 жыл бұрын
Not all good devs use macs :)
@ravenjs
@ravenjs 3 жыл бұрын
Hahaah thanks for the compliment Gin AHAH :)))
@JacksonRossi
@JacksonRossi 2 жыл бұрын
If you want a randomly generated ID (so that you don't have to make a unique identifier each time), you can use add() as opposed to set() import { collection, addDoc } from "firebase/firestore"; // Add a new document with a generated id. const docRef = await addDoc(collection(db, "cities"), { name: "Tokyo", country: "Japan" }); console.log("Document written with ID: ", docRef.id);
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
Using Cloud Firestore For Your REACT Backend 2023 | CRUD App
51:15
Travis Media
Рет қаралды 24 М.
Subcollections in Firebase/Firestore v9 (with React.js)
22:33
Getting started with Cloud Firestore for the web
13:52
Firebase
Рет қаралды 139 М.
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 326 М.
React With Firebase/Firestore | CRUD and Queries | Version 9
14:27
Sam Fromaway
Рет қаралды 25 М.
Firebase v9 Storage in React | Upload Files to Cloud
11:08
Fullstack Simplified
Рет қаралды 30 М.
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН