BASIC Express JS Crash Course
20:39
The No 1 MOST Popular NPM Package
10:39
Frontend vs Backend for Beginners
12:14
Upload MULTIPLE IMAGES to Cloudinary
22:22
Пікірлер
@ameen1450
@ameen1450 25 күн бұрын
nginx not working when public ip is pasted
@jayeshchindarkar
@jayeshchindarkar Ай бұрын
Can you please give me all the react installations starting from the initial setup. Nice video was great help
@adrielomalley
@adrielomalley Ай бұрын
useful video you should do more!
@Abil15
@Abil15 Ай бұрын
Bro nice can you send me the video link for ssl certification for website
@noobie379
@noobie379 Ай бұрын
Where is the source code?
@stanislavdidenko8436
@stanislavdidenko8436 Ай бұрын
thanks for turorial, though. It is weird it worked for you in sequential manner always. For me not. Basically state update is asyncronous. So you likely to send to the socket a non-updated chat function addMessage(chat){ const newChat = {...chat , user:localStorage.getItem("user") , avatar} addToFirrebase(chat) setChats([...chats , newChat]) sendChatToSocket([...chats , newChat]) }
@stanislavdidenko8436
@stanislavdidenko8436 Ай бұрын
Let's analyze the relevant parts of the tutorial code you provided, focusing on the addMessage function and the related socket handling, and address why it might have worked without the functional update pattern: Key Parts of the Code State Initialization: javascript const [chats, setChats] = useState([]); Sending a Message: javascript function addMessage(chat){ const newChat = {...chat , user:localStorage.getItem("user") , avatar} addToFirrebase(chat) setChats([...chats , newChat]) sendChatToSocket([...chats , newChat]) } Why It Might Have Worked Timing and User Interaction: If users are not sending messages in rapid succession, the state chats may have the expected value at the time sendChatToSocket([...chats, newChat]) is called. This means that even without using the functional update form, it worked because the updates happened in a way that maintained the expected state context. Batching of Updates: React's batching behavior allows multiple state updates to be handled more efficiently. If the state change happens due to a user action (like clicking a button), React batches those updates. If there is a slight delay or pause after one message is sent before another message is sent, the chats state may have updated in between calls, making it appear as if the non-functional pattern worked. Single User Context: In a simple scenario with a single user interacting with the chat, the likelihood of encountering race conditions is lower. If there’s only one source of updates (the user), it can create a sequential appearance. The Problem with the Current Approach While it might seem to work, the approach is fragile for a couple of reasons: Stale State Issue: If you were to implement a feature where multiple messages could be sent rapidly (e.g., pressing the "send" button multiple times), the chats array might not reflect the newly added message when the socket emits the chat. Lack of Predictability: As the application grows, maintaining state with a non-functional approach can lead to unpredictable bugs, especially when more components depend on the same state. Recommended Fix To ensure the latest state is used, you should adopt the functional update pattern, which ensures that you always work with the latest state: javascript function addMessage(chat) { const newChat = { ...chat, user: localStorage.getItem("user"), avatar }; addToFirrebase(chat); // Add to Firebase setChats((prevChats) => { const updatedChats = [...prevChats, newChat]; // Use the latest state sendChatToSocket(updatedChats); // Emit the updated chats return updatedChats; // Update the state }); }
@urbanpuma9136
@urbanpuma9136 Ай бұрын
Thanks. How to solve the issue from the front end if sending request to remote server?
@ghazal.muayad.alotaibi2013
@ghazal.muayad.alotaibi2013 Ай бұрын
Is this english or computer??
@JahidHasan-zl7om
@JahidHasan-zl7om Ай бұрын
how can i make it automatic run whever PC starts
@adithvijay2395
@adithvijay2395 2 ай бұрын
Shit contet dint watch
@jayshah8271
@jayshah8271 2 ай бұрын
how to debug the code please do the video on it N
@kevaltank6292
@kevaltank6292 2 ай бұрын
is it free forvever or it's paid after a certain trail time
@bjgjuiuguoojpoo
@bjgjuiuguoojpoo 2 ай бұрын
Learn how to make tutorials, because 20 minutes go by and you're fiddling with styling and still making basic mistakes! If you are making a tutorial about sending emails, make it about that, not about how to play with css!
@Vivekpatel-hh7sr
@Vivekpatel-hh7sr 2 ай бұрын
use normal keyboard, it is disgusting voice, i have to skip watch this video i will find another chat video. thank you before uploading video first you have to check the video.
@notheory-norules5915
@notheory-norules5915 2 ай бұрын
a video that could be shortened to 2 mins -- of useful information -- talking tooooo much
@rohit36910
@rohit36910 3 ай бұрын
Thank you so much 🙏
@matthealy7180
@matthealy7180 3 ай бұрын
this video is excellent. thank you for this. is it up-to-date though? i am trying to insert a breakpoint as per around 6:25 but no dice :( very possible that im doing it wrong
@matthealy7180
@matthealy7180 3 ай бұрын
nvm i found the problem. i was trying to insert a breakpoint where one wasnt valid. i would delete this comment so that i dont look stupid but i want to increase your engagement for the SEO. happy coding :)
@NarasimhaRaju-y9i
@NarasimhaRaju-y9i 3 ай бұрын
nginx does show in my public ip after installation it shows "This site can’t be reached 13.201.137.0 refused to connect." and 22,80,443 all ports are available in security group please help
@JonasKr.
@JonasKr. 3 ай бұрын
very useful tutorial.. thanks a lot man
@Satya-o3s
@Satya-o3s 3 ай бұрын
what u down load to push download
@everythingjdm8057
@everythingjdm8057 3 ай бұрын
great video man
@1111ah
@1111ah 3 ай бұрын
Great video. Thanks!
@witelfortgelin5377
@witelfortgelin5377 3 ай бұрын
Hi sir! I need a dev like you to learn me mern stack web application on aws, how I can enter in contact with you pls?
@AnupumPant
@AnupumPant 3 ай бұрын
How do i configure nginx if my other app is running on other port simultaneously.
@Zohan0502
@Zohan0502 3 ай бұрын
use good microphone the explanation is good
@JestinaNJones
@JestinaNJones 3 ай бұрын
Kindly help with the debug(er) video pls.
@legendary5320
@legendary5320 3 ай бұрын
Great video. Clear concise and to the point.
@Natefuller8
@Natefuller8 3 ай бұрын
Super helpful even one year later! Excellent tutorial style very easy to follow.
@DmitriZaitsev
@DmitriZaitsev 4 ай бұрын
Pls use timecodes
@prezlamen
@prezlamen 4 ай бұрын
Thank you for zoom!!! Easy to see for everybody.
@awaraamin6850
@awaraamin6850 4 ай бұрын
Thank you so much sir
@ruqayahn.k4645
@ruqayahn.k4645 4 ай бұрын
good thanks
@techybhoot
@techybhoot 4 ай бұрын
your video was amazing helped me to deploy my project thank you very very much
@rkvcherry5535
@rkvcherry5535 4 ай бұрын
What about that pm2 when i deploy in render ...m Does it even run as expected without changing anything
@HuyNguyen-en4pr
@HuyNguyen-en4pr 4 ай бұрын
Thank you so much. I was struggling so much to figure out how to just deploy my backend api to heroku and i kept getting error after error after error. I came across your video and now it finally works. You are a life saver!
@Aravindh143s
@Aravindh143s 4 ай бұрын
bruh just installing PM2 that's it? there is no any setup in package.json file or anywhere? i mean modifications like for jest
@sanketemala1118
@sanketemala1118 4 ай бұрын
literally the best video on this error, solves all the problem while giving all the information
@Lorenzo-ky6yz
@Lorenzo-ky6yz 4 ай бұрын
Great video my fellow South African.
@angelozorn9740
@angelozorn9740 4 ай бұрын
fantastic video thank you!
@hihello26262
@hihello26262 4 ай бұрын
bro is goated
@rontheprogrammer
@rontheprogrammer 4 ай бұрын
thanks man
@doniyorbekmaksudov4616
@doniyorbekmaksudov4616 5 ай бұрын
It didn`t work!
@Ntrleye
@Ntrleye 5 ай бұрын
Yo What if, im using VITE?
@briwaysol
@briwaysol 5 ай бұрын
But it’s not free
@thechoosen4240
@thechoosen4240 5 ай бұрын
Good job bro, JESUS IS COMING BACK VERY SOON; WATCH AND BE PREPARED
@abuasim1000
@abuasim1000 5 ай бұрын
You started beautifully, but started just pasting the codes for your convenience. this is not a useful tutorial who don't know about dnd. It appears you are teaching yourself.
@ORA268P
@ORA268P 5 ай бұрын
Really useful overview, thanks!
@karlstenator
@karlstenator 6 ай бұрын
PM2 is fantastic! Thanks for sharing.
@Saucehero29
@Saucehero29 6 ай бұрын
how can i run it in hostinger cron job?
@Rikrolled
@Rikrolled 6 ай бұрын
Thx Guy