if anyone receive the msg twice you can solve that issue like this: useEffect(() => { socket.off("receive_message").on("receive_message", (data) => { setMessageList((list) => [...list, data]); }); }, [socket]); And thank you so much for this video i was really looking to understand the concept of chatting waiting for the second part.
@olexandrsokolyk46902 жыл бұрын
Thank you )
@rokibgyimah86758 ай бұрын
Thank you very much. But please why we should add "socket.off("receive_message")" ?
@ine_kid8 ай бұрын
thanks
@cryptofolks672 ай бұрын
thanks heaps
@fanifrancs Жыл бұрын
wow, you are doing great bro. I have been searching for react videos and your videos usually pop up. I have been loving your tutorials.
@brilliantatosam3 жыл бұрын
Best video on the internet about this topic. You're a wonderful tech teacher
@PedroTechnologies3 жыл бұрын
Glad you think so!
@lakkuntlanaveen16789 ай бұрын
@@PedroTechnologiesin this vedio u didn't connect with mongodb
@maxwong46572 жыл бұрын
Awesome tutorial as always!! very clear and elaborated! However, when I tested my app, there was an issue that when. I send a message, and the message is displayed twice. The solution is : in the useEffect() hook, we have to write the cleanup function below: return () => socket.removeListener('receive_message') It will fix the problem.
@denisjunior10862 жыл бұрын
Can you explain why we have to put this ?
@jonelbarrientos70572 жыл бұрын
thanks bro
@thequang92342 жыл бұрын
thanks bro
@nikhilvijayan34112 жыл бұрын
Thanks for this, Max
@ankurgoswami44412 жыл бұрын
thanks bro
@spondoolie6450 Жыл бұрын
If anyone is having problems with the messages double-rendering.... React v18 (which came out after this video) now double-renders the useEffect hook and you'll see the messages double-feed in the chat. To solve this problem use the useMemo hook.... and still use "socket" in the dependency array.
@codevanie-misery Жыл бұрын
In what part do I put the useMemo hook?
@programmingrush Жыл бұрын
thanks bro, i was figuring it out
@saisushanth8507 Жыл бұрын
bro, why was that happening and how can useMemo hook solve the issue??
@jotaroisdarius1918 Жыл бұрын
@@saisushanth8507 it's because of react strict mode, and it only happens in dev and not prod, if you check the index/main file of your react app you're gonna notice that's it's wrapped around StrictMode tags, just remove them ( not recommended )
@lucas-kg7bj Жыл бұрын
@@jotaroisdarius1918 this is the fix
@MyRc162 жыл бұрын
Hi Pedro! Great Video. Just in case someone need it i was having an issue where messages where being sending twice, i couldnt explain why, wasted 1 hour of my time comparing my code with pedro's and at the end it was the React.StrictMode wrapping my App, stric mode renders components twice that was why n.n
@SilkroadBower2 жыл бұрын
Aaahhhhh thank you mate I didnt know that!
@Webbi_Trax2 жыл бұрын
life saver!!
@muhammadfurqan77992 жыл бұрын
thanks!!!!!
@youssefhisham49232 жыл бұрын
how to solve then ?
@datkumar10242 жыл бұрын
Thanks brotha🤝
@sohamkadam50183 жыл бұрын
Best KZbin channel for beginners as well as intermediate developers.
@PedroTechnologies3 жыл бұрын
Wow, thanks!
@penelopejungreis93553 жыл бұрын
Thank you so much, I was still confused after your video from last year but this one really cleared that up about the Server class, cors object settings, and the use of the localhosts!
@PedroTechnologies3 жыл бұрын
I'm always trying to improve old videos hahaha i am happy that this one helped :)
@vasukhandelwal22332 жыл бұрын
@@PedroTechnologies Can you explain why when you send a message from left pane of google chrome tab why does it only console.log only on right pane when both have joined a room??
@ayushdedhia253 жыл бұрын
Bro really needed this.... 💯🔥❤️
@TheNamesJT3 жыл бұрын
57:05 i'm getting double scroll bars? Update: Fixed this issue by removing the overflow:scroll on line 85 in the css file. Because the npm package react-scroll-to-bottom already adds the scroll bar.
@LeeanRepzTraining3 жыл бұрын
BROO the best tutorial of this sooo far lets go!
@PedroTechnologies3 жыл бұрын
Glad you think so!
@hyrixlele89592 жыл бұрын
Some people are just meant to be teaching ! clean explanation Thank you
@god2be3 жыл бұрын
it's so easy to explain, I understood right away =) but before that I looked at other chat examples and the guys there couldn't really explain how the websocket works! so thanks!
@PedroTechnologies3 жыл бұрын
Great to hear!
@samyf89492 жыл бұрын
This is one of the clearest tutorial i've seen. really love your content and appreciate what you do !
@P.D.V.J3 жыл бұрын
Amazing tutorial! Was able to get through every step, can't wait to expand on it
@shivamkhandelwal2707 Жыл бұрын
the way u teach people is tooooo cool for everyone who is beginner.Thanks for ur amazing tutorial
@Asia_life_explorer2 жыл бұрын
Man haven't seen a guy who explains like you, I'm wondering why aren't you having millions of sub?
@thushithamanokaran20403 жыл бұрын
This is really awesome.. If you end up making the part two, could you please include saving messages in a database, deploying etc?
@PedroTechnologies3 жыл бұрын
Im thinking that maybe saving in a database would be cool!
@ronaldc86343 жыл бұрын
Seconding the deployment part!
@한준규-e1e3 жыл бұрын
@@PedroTechnologies Hey Pedro, seconding this!! that's gonna be super awesome man
@asthadad98793 жыл бұрын
@@PedroTechnologies when you are creating second part ?
@volanddevil80153 жыл бұрын
@@PedroTechnologies do it please!
@ThColinPereira3 жыл бұрын
I was thinking of doing a project using socket io and your video shows up! It’s like you read my mind!!
@PedroTechnologies3 жыл бұрын
Colin
@cesaralanis42133 жыл бұрын
This is exactly what i was looking for dude!! Yo have some skills to teach, so detailed and easy to understand!! thanks and congrats!!
@Odidi_Bee6ix Жыл бұрын
Awesome stuff 💯. Anyone planning to watch this in 2023 and above pls use vite to create the client side of the application. It'll save you a lot of hassle
@dxrk81 Жыл бұрын
this ^
@sohamganmote7998 Жыл бұрын
Man Your Teaching Skill are on next level i learned more here than my collage
@artimgashi60243 жыл бұрын
Man this is a fantastic tutorial, keep doing this !! Also wanted to ask if u can make a video for making chat apps with SignalR, i'm sure you've heard of it.
@michaelmyers7173 жыл бұрын
God damn Bro! I had a cors problem and tried to fix it literally a week, i'm so thankful to u :*
@aphmaia12 жыл бұрын
Hi Pedro! Amazing video, I learned a lot from it! Could you make a separate video showing how to use a database with this chat? Hugs from brazil!
@josephchimebuka41432 жыл бұрын
This guy is crazy how did he do this in 1 hr?... Thanks a lot man you're awesome!
@brunogbrito2 жыл бұрын
Very well done man, um dos melhores tutoriais, super bem explicado! Rolou a parte 2?
@someone94933 жыл бұрын
Thanks!
@PedroTechnologies3 жыл бұрын
Thank you Yaroslav!
@whatsinaname38373 жыл бұрын
Perfect tutorial. LoL. Thanks, Pedro for remaking videos when these libraries get updated.
@sagarchawla4926 Жыл бұрын
41:30 i am doing the same way as you did, i am also console logging data ones, but its getting logged twice
@wfgundam2 жыл бұрын
thank you! was able to deploy with less of a struggle with CORS. thanks for the updated video!
@marcoberry55417 ай бұрын
Please how did you deploy this
@redabekka59402 жыл бұрын
thanks for tutorial for those who have face problem with message that shows twice the solution is to do a cleanup function to useEffect like this : useEffect(() => { let test = false; socket.on("receive_message", (data) => { if (!test) setMessageList((list) => [...list, data]); }); return () => { test = true; }; }, [socket]);
@Xavier-jf7wd2 жыл бұрын
Still getting twice the solution
@matrix_prime7392 жыл бұрын
👍👍👍 thank you very much .I was searching for this kind of any video on youtube and this video really very good explained and one of the clearest tutorial i've seen.
@ilaymorozoff41133 жыл бұрын
It is the amazing tutorial, thanks! Your channel is the best!
@PedroTechnologies3 жыл бұрын
Wow, thanks!
@shahipapon8332 жыл бұрын
Your 18 mins just blowed me. ❤️ and rest of the sec to sec I was impressing 🥰 impressing ❤️ impressing 😍😍 ad finally boommm,💥💥💥.. I can't express my thought in these few words. Just You will be in my heart ❤️❤️. You unbelievably make socket clear than water ❤️❤️❤️❤️
@PedroTechnologies2 жыл бұрын
Hahaha I appreciate it!!
@matthewfisher1874 Жыл бұрын
great video thank you so much, ive been looking for how to make a react chat app without using external apis, and this video is a perfect
@Switchfusiontech2 жыл бұрын
thanks pedro this is lovely, i have alittle challenge with mine, the messages seem to deliver twice and i cant seem to pinpoint where the problem is coming from in the server area
@virgiliolopez38432 жыл бұрын
Hi. Just wanna share the solution I found after an hour of trying to fix the same issue. The solution is to go to 'index.js' in your client folder (NOT the index.js file in the server folder) and remove just the and line. This is actually a new feature in React 18, which was just released in March 2022, which is why the behavior in the video is different.
@agathahelenafariasmoratogo96142 жыл бұрын
@@virgiliolopez3843 It worked! Thank you so much!!
@ismael.lastlevel2 жыл бұрын
Wow . I was struggling with the cors issue and now I fixed it. Thanks 👌🏾
@whierthy26082 жыл бұрын
amazing video ... was struggling to find a short project to learn something new this one really did the work thanks A lot
@josephgitonga37392 жыл бұрын
GREAT GREAT tutorial dude ....you've helped incredibly. Thanks so much
@ayl2473 жыл бұрын
happily subbed awhile ago. Great vids for refresher and learning!
@PedroTechnologies3 жыл бұрын
Thank You!
@ranabirmandal87332 жыл бұрын
please help, i'm unable to emit message from socket backend to client. I could console log the data coming from client but server is unable to emit. nothing in the console of browser
@AliAkbar-zv4jv2 жыл бұрын
did you find a sol?
@bbunited_pvp3 жыл бұрын
This is certainly what I need. Thank you so much.
@francescoPace2711 ай бұрын
You are the best man! Thank you very much for this amazing tutorial
@pcalozen2 жыл бұрын
Very nice Pedro, congrats, helped me a lot . I also didn't know that Hughie from The Boys' super power was coding so well.. kkkk!
@chintalapudirohitmanikanta44922 жыл бұрын
Can't see output in my brave browser console and getting this error in console Failed to load resource: net::ERR_CONNECTION_REFUSED I'm stuck at 41:00 in the tutorial Can someone help..
@henrykibocha52243 жыл бұрын
Great Tutorial no CORS errors
@prayascsa66012 жыл бұрын
I'm on the 100daysofcode challenge and i was feeling super down and didn't feel like coding, I saw this vid while scrolling and decided i'll do this, and I'm ashamed to say that i kinda just copied what you did while watching the video, but I still understood a lot of things so I guess I still did something good
@mohammedmehdi1940 Жыл бұрын
this is the best video for this topic 🛐
@ayushprajapati9486 Жыл бұрын
works fine in 2023 .. great vid
@hazelcaling6 ай бұрын
The best!! Thanks Pedro!
@subhajitadhikary-994 ай бұрын
The issue with two times showing message on screen is due to react strictmode from version 18. Either you could go to index.js file and remove the wrapper from , but I will not recommend as its given for a purpose to check issues in dev mode. The next thing which is ideal and given in react docs for useEffect hook as well -> which is using return statement with useEffect and inside that, you can write socket.off('event-name', methodName) , which should resolve the issue. Btw, thanks PedroTech for such great content.
@ishikaagrawal26224 күн бұрын
Can you please give the code please what you exactly want to say about useEffect over here..
@ShadyRonin Жыл бұрын
Incredibly helpful, thank you so much Pedro!!!
@ludisinfo10482 жыл бұрын
Thank you very much Pedro !! Excellent Tutorial, very well explained, easy to follow and very useful ... As Thushitha mentioned It would be great to see a second part with database connection (may be Mysql or Mongo) as well as deploying in Heroku perhaps ? ... in any case It was a fantastic video ! Best Regards from Germany ! :)
@yilinliu96872 жыл бұрын
For saving data to database, in my point of view, after building and connecting database, you could add a query function under the socket io receive message. For instance, mongoDB, ``` findOneAndUpdate()```it will get it saved to database. Then deploy to Heroku, Heroku has step by step documentation to follow
@victorkipkoech35582 жыл бұрын
wonderful had a problem with socket now imma do wonders🥳🥳
@ВолодяЛеськів Жыл бұрын
Nice tutorial. Thanks from Ukraine, mate!
@prasanths896011 ай бұрын
Perfect bro...Like from india...👏👏👏
@maciejromiszewski69549 ай бұрын
Dzięki! Tego szukałem!
@uzndev22423 жыл бұрын
Thank you for this perfect tutorial Pedro!
@110Genesis3 жыл бұрын
You are awesome Pedro. Much appreciated
@PedroTechnologies3 жыл бұрын
I appreciate that!
@Zarinabaloch7163 ай бұрын
Hi pedro! You did a great job!
@akshatbarwal102 жыл бұрын
Hi Pedro, great tutorial! I have a doubt or rather a bug in the code. When I send a message from another user to me, the message is being sent more than once. I did remove the React.StrictMode in the index.js file but it is still showing up multiple times. If anyone can help pls do. Thanks again : )
@bencostas20332 жыл бұрын
I’m having the same issue, if you find a solution can you let me know
@vivekpaliwar72172 жыл бұрын
Did you found any solution for that ?
@georgi15592 жыл бұрын
he is actually getting the same bug in the video and just ignores it like it is not obvious.. idk why he did not fix it, cuz it happened like 3 times
@jayc65352 жыл бұрын
found this on stack overflow: socket.off('recive-message').on("recive-message", (data) => { console.log(data,'recive'); setMessageList((list) => [...list, data]); });
@morphine30162 жыл бұрын
in the useEffect() hook, we have to write the cleanup function below: return () => socket.removeListener('receive_message') It will fix the problem.
@bencostas20332 жыл бұрын
Hi thank you for the tutorial, I’m getting an issue when receiving messages, it appears twice. I checked the GitHub code and my code looks the same and went through the tutorial once again. Does anyone know how to fix this issue?
@redabekka59402 жыл бұрын
it's the same problem for me did you fix the problem
@hamad51412 жыл бұрын
Go to index.js, and remove . So you should only see. root.render(); This worked for me :)
@alexzil21422 жыл бұрын
This is so great. Used this for my react native project. Thanks
@derekspecial1771 Жыл бұрын
Thanks pedro❤
@ShivamGupta-oy8mu2 жыл бұрын
you have made things very easy to understand. This tutorial is really awesome.
@md.sajedulislam5802 жыл бұрын
Thanks Pedro, this is an amazing tutorial.
@josetuz3 жыл бұрын
Thank you very much from Argentina!
@KingsleyOkeze2 жыл бұрын
At 18:00 I keep having issues there, it didn't display that a User is connected when I logged to the console, how do I fix it?
@bartoszszmit2 жыл бұрын
PedroTech, is this course like full chat app course or maybe kind of your free youtube short version? Cause in nerest future I will need node.js full chat app course to learn. Are you?
@chisomeze3884 Жыл бұрын
Pedro thanks so much , you saved my life frr ❤❤❤❤
@yadhukrishnacu300411 ай бұрын
40:10 didn't get the message in client side
@sahil007-d2h10 ай бұрын
same problem bro , did you got any solution ?
@yadhukrishnacu300410 ай бұрын
@@sahil007-d2h yeh bro i was just missed to join the id. Just make sure you joined the room or id whatever
@tiny_mystery Жыл бұрын
Great and helpful video bro ! Keep doing that.
@shakilpendhari4525 Жыл бұрын
I love this video very nicely explains everything.
@k303k Жыл бұрын
Love you bro!!! I've learned so much from your channel
@zude11003 жыл бұрын
Thanks, I finally managed to fix the cors issue I faced for over a day.
@Mani-fb3mi2 жыл бұрын
Practical AFFFFFFFF thx pedro
@alexkoval25822 жыл бұрын
You explain really clear! Amazing!
@zeeshanlatif8751 Жыл бұрын
It's perfect. Informative and Interesting!
@growthhacking91263 жыл бұрын
Pedro my bro thank you for this lovely tutorial, can you please make a tutorial on real time location tracking like delivery apps. Where you can see real time product arrival.
@apeiron44093 жыл бұрын
love your tutorials always
@aqsaazfa16873 жыл бұрын
I subscribed this channel at first video cool channel
@PedroTechnologies3 жыл бұрын
Thank you :)
@porlearktuy47113 жыл бұрын
Welp, I was bashing my head against the wall trying to make a chat app like this the other day and caved in to look for help today. Talk about a coincidence.
@PedroTechnologies3 жыл бұрын
Hahaha glad you liked the video!
@mansourmalekzadeh87282 жыл бұрын
Amazing! thanks a lot dear Pedro.
@rawansayed8707 Жыл бұрын
That was really really helpful. i learn alot from you! Thanks!!
@valeriastorozhuk482 жыл бұрын
thank you so much for your amazing tutorial! very specific! love it!
@eddymono17247 ай бұрын
Nice video, It is clear and understandable.....I love this tutorial
@kebabkent58842 жыл бұрын
If I wanted to make my own website that anyone could access with this as the base code, how would I go about doing that? Ive tried with firebase but I just cant make any sense out of it. Please help!
@nataliamikhieieva8131 Жыл бұрын
Thank you Pedro !! very cool !
@JaiVang-b4q11 ай бұрын
What extensions are you using to automatically space, add semicolons, and change ' to "?
@nidhishettigar69812 жыл бұрын
WARNING in src\App.js Line 4:7: 'socket' is assigned a value but never used no-unused-vars I am getting this warning at 17:49 from video and not able to connect to server. Please help.
@quintonpangyixuan39902 жыл бұрын
Check and see if this works for you?kzbin.info/www/bejne/jqe0mJaPZ9SNq8k
@_dikay2 жыл бұрын
glad i found this video👍
@VladBatalin Жыл бұрын
hey thenks for perfect lesson! keep it up the good work!
@nhatminh45211 күн бұрын
i love this
@ShubhamPatil-rr4on3 жыл бұрын
This is amezing ♥️♥️♥️♥️
@sarthaksingh91832 жыл бұрын
thanks brother you made my day
@ruizhu58992 жыл бұрын
it's very amazing video thank you, and can i know if you solve the small bug in the end, that the user will rerender 3 times after we used controll element for clearing value after emite event, thank you
@nurhamsah_tech Жыл бұрын
thanks bro, you r always be my favorite 💯💯
@misfitgems3 жыл бұрын
This is dope bro!
@arysetansy49662 жыл бұрын
Oh Pedro, meu querido, cade a parte de desconectar? Especificamente um usuario...?