The Most Hated React Code!

  Рет қаралды 42,593

Programming with Mosh

Programming with Mosh

Күн бұрын

This picture has been floating on the Internet these past few days and has received a lot of criticism from the community. This is part of the Next.js conference that was held last week. A lot of people argue that the code presented in this slide is violating many of the best practices we've learned. In this video, I'll explain my point of view on these arguments and share why I think the direction that React and Next.js are taking is a great direction.
LEARN NEXT.JS
Next.js Tutorial for Beginners: • Next js Tutorial for B...
The Ultimate Next.js Course: codewithmosh.com/p/ultimate-n...
MORE FROM MOSH
Courses: codewithmosh.com
Blog: programmingwithmosh.com
Facebook: / programmingwithmosh
Twitter: / moshhamedani
#nextjs #reactjs #webdevelopment

Пікірлер: 116
@incarnateTheGreat
@incarnateTheGreat 5 ай бұрын
I appreciate that your perspective on this was well-thought out and considerate of what the Vercel/Next team has been trying to do. The whole Separation of Concerns principle now somewhat changes because of this ability to work within the confines of the component, which is something that hasn't really been much of a thing leading up to now. Things change, I suppose.
@JWW_is_cool
@JWW_is_cool 6 ай бұрын
clear, concise, and easy to understand hope you can make such video that talks about some frontend tech in the future
@AmirnajiRivaz
@AmirnajiRivaz 6 ай бұрын
Excellent clarification, as always clear, concise & to the point. Appreciate your efforts, keep up creating quality content man⚡
@AmirGolmoradi
@AmirGolmoradi 6 ай бұрын
Dear Mosh, I have learned everything I know so far from your KZbin courses, and I am grateful for your knowledge and expertise. I am eager to learn Java, Django, and NodeJs, and I trust your courses more than any others. Would you please consider updating your courses on these topics?
@malikgenius4u
@malikgenius4u 6 ай бұрын
awesome explanation mosh, i am in the middle of your Next.js course second part, and i remember my days of creating APIs in express.js and keeping the frondend and backend separate, this will speed up our development but one need to keep security in place while writing sql queries and do not let things slip away ..
@akuoko_konadu
@akuoko_konadu 6 ай бұрын
Behold the React taint API is coming 🧙‍♂️
@eligbuefelix7988
@eligbuefelix7988 6 ай бұрын
Separation of concerns goes beyond splitting abstracting out functions. This is only applicable in very small projects and functions that require light computation.
@lifebyvikk6751
@lifebyvikk6751 6 ай бұрын
Mosh, I just want to say you are a good teacher and a software engineer and it makes me sad and jealous when I see you create fantastic courses but specifically for web Devs,how I wish you were on this side of data science and ML.
@ademineshat
@ademineshat 6 ай бұрын
Great video 🎉 With this we definitely will get a PHP course from Mosh to prove that PHP isn't what people say 😅
@acodersjourney
@acodersjourney 4 ай бұрын
Thank you for being a beacon of knowledge in the vast sea of coding information. Your videos are a lifesaver!
@nikhilsnayak3473
@nikhilsnayak3473 6 ай бұрын
This is the exact thing I was looking for some to talk ❤
@maskman4821
@maskman4821 6 ай бұрын
Great hints and tips 👍👍
@averythin348
@averythin348 6 ай бұрын
Clear concise and easy to understand 👍👍
@whonayem01
@whonayem01 6 ай бұрын
Thanks for clarifying
@waleedsharif618
@waleedsharif618 6 ай бұрын
Could you possibly say should we use Create React App or Vite in production ?
@cloudstrife7083
@cloudstrife7083 6 ай бұрын
Mosh what's your opinion about Javascript and React today in 2023 compared the others technology stack like Java and C#. Net ... I am a sysadmin linux/windows thinking about going back to programming after 25 years (was coding C++) was thinking about a strong year of study 15hr/a day of just JS/React I could reach junior intermediate level but is it still popular and have great career opportunity ? I am asking this because programming will allow me to develop a 100% remote career more easily than manging the cloud or system etc where you contact and have to meet more ppl
@itsbrod
@itsbrod 6 ай бұрын
Bruh waiting for this course to began
@sunny_singh_rajput8970
@sunny_singh_rajput8970 6 ай бұрын
Hey Mosh, you are amazing and doing great work. I am a developer because of you. I have been watching your videos since the beginning. Please make some videos on Go language. Love You Buddy❣❣(from india)
@ahnmebnsina381
@ahnmebnsina381 6 ай бұрын
Do you have plan to update to server actions in your nextjs course?
@evan0754
@evan0754 6 ай бұрын
Hi Mosh What Theme and font do you use in the vs code?
@user-nd4sh5of2m
@user-nd4sh5of2m 6 ай бұрын
Mosh, you are a great teacher. "Simplicity is the ultimate sophistication", I agree. Continue to make these wonderful courses. Thank you very much.
@swapnilpatel3337
@swapnilpatel3337 6 ай бұрын
It is safe code many people say its bad and bug not if your good developer please check agian because query write in ` ` function argument pass not string whole please check in your code and then say
@zefikeritinaharry5981
@zefikeritinaharry5981 6 ай бұрын
Dear Mosh, Can you make a PHP course?
@css2165
@css2165 6 ай бұрын
I hope you keep uploading like this. Love from bangladesh❤
@fransiscowijaya
@fransiscowijaya 2 ай бұрын
your thumbnail just got more attractive, great style 😅
@patriciorosso4226
@patriciorosso4226 6 ай бұрын
What if I want to unit test that component? suppose theres something wrong with that query and i end up discovering it due to testing... is that fine? i am asking for real
@corexemelmedia2
@corexemelmedia2 3 ай бұрын
Should there be php, ci4, laravel course ??
@mouradeljayi584
@mouradeljayi584 6 ай бұрын
Great explantion
@corexemelmedia2
@corexemelmedia2 3 ай бұрын
Should there be php’s laravel and ci4 course
@AaronAnnu
@AaronAnnu 6 ай бұрын
Hi sir . Can you please make a video about manual testing ..??🙄🙄
@Viyas-es3bj
@Viyas-es3bj 6 ай бұрын
hello can you please post an oops related class and interfaces in javascript We're waiting for that.....
@bullettime2808
@bullettime2808 6 ай бұрын
I guess a ton of people don't know about calling functions with template string in js
@adambickford8720
@adambickford8720 6 ай бұрын
Congrats on discovering monolithic architecture; this is how we did it 20+ years ago before REST was the defacto standard. No, not just PHP, everything. Full server-side rendering/state/actions with a little jQuery (or whatever) where it was absolutely needed on the client. The upside to tight coupling is its productive, the downside is that its brittle. If your app is a 1-off you're going to completely rewrite? Great. If it's something that has to last through multiple years, tech shifts and dev teams? Not so much.
@Sammy2100
@Sammy2100 6 ай бұрын
This reminds me of when I used classic ASP (VBScript) with jQuery twenty years ago.
@alex_chugaev
@alex_chugaev 6 ай бұрын
All the best practices went out of the window holding hands 😂
@SeifCookz
@SeifCookz 6 ай бұрын
mosh,please reply,you are the reason i mastered python and i am learning html and c++,PLEASE,I LOVE YOU MAN!
@programmingwithmosh
@programmingwithmosh 6 ай бұрын
That’s awesome to hear! Thank you!!
@SeifCookz
@SeifCookz 6 ай бұрын
i am so delighted to meet my DREAM person!!!!,youve got me through python and c++,you saved me days@@programmingwithmosh
@minimalsforlife740
@minimalsforlife740 6 ай бұрын
This means no need to use fetch or axios anymore?
@ScaerieTale
@ScaerieTale 6 ай бұрын
Spooky. I was literally just learning about how to use Axios last night. Anything that means I have to write less boilerplate is ok by me!
@giannismentz3570
@giannismentz3570 6 ай бұрын
Yeah man, this is awesome!!! Let me know when you use this, reply with your production URL, I'd like to ehm... see how good this is on your website... 🤣
@asadullahaziz
@asadullahaziz 6 ай бұрын
This is called abstraction. many complex and repetitive things that engineers used to do has been abstracted away in the past. This is just like that and many full stack frameworks will do this in future. If some new devs think that we wont need to create network APIs any more they are wrong. As, Mosh explained programming isn't black and white.
@PS-dp8yg
@PS-dp8yg 6 ай бұрын
Isn't the whole purpose of creating an API endpoint to decouple the front-end from the back-end? What if I need different clients (web, mobile, desktop, etc.) consuming the same API?
@programmingwithmosh
@programmingwithmosh 6 ай бұрын
If you need multiple front-ends, then you need an API.
@PS-dp8yg
@PS-dp8yg 6 ай бұрын
@@programmingwithmosh The example in the video is tightly coupled to React. You'll be stuck with a React application unless you re-write to entire application to use an API to support multiple front-ends (react, vue, react-native, android, iOS, etc.)
@lord_kh4n
@lord_kh4n 6 ай бұрын
@@PS-dp8yg dude, just change the sql statement into a Fetch/Axios call and you are good to go
@itsbrod
@itsbrod 6 ай бұрын
So much exciting 😺🎉🎉🎉🎉❤
@saeedalobidi4195
@saeedalobidi4195 6 ай бұрын
Creat video, I have an observation that when I want to execute the same SQL query for a different application instead of using an API that contains the same SQL query, I have to rewrite that SQL query again.🤨
@programmingwithmosh
@programmingwithmosh 6 ай бұрын
Do you mean a different front end like a mobile app needing to add a bookmark? If so, in that case yes you need an API endpoint because the second front end is gonna to be a different project using a different framework eg React Native.
@saeedalobidi4195
@saeedalobidi4195 6 ай бұрын
@@programmingwithmosh 💯
@juniorMr
@juniorMr 6 ай бұрын
The best yutube teacher, I wis i had opportunity to meet you personally
@anonymous12478
@anonymous12478 6 ай бұрын
why are you not using tsx?
@njongefred
@njongefred 6 ай бұрын
Please do a course for ruby on rails❤😢
@p.martin4381
@p.martin4381 6 ай бұрын
In my opinion,separation of frontend and backend is a trend,nextjs is aim to focus template rendering,api query and sql query should be done on real backend such as java springboot or Python/Nodejs/C#
@nurudeenhamzah5011
@nurudeenhamzah5011 6 ай бұрын
GOAT of TEACHERS
@pedrojunior4516
@pedrojunior4516 5 ай бұрын
Any Rust course in production?
@yt-sh
@yt-sh 6 ай бұрын
pretty good point!
@mahmoudhamdy9550
@mahmoudhamdy9550 6 ай бұрын
I want to buy the full stack JavaScript course can I paid by Egyptian pound?
@mahmoudhamdy9550
@mahmoudhamdy9550 6 ай бұрын
@@LilyKZbinr. please mosh help me to buy this course
@crod1232
@crod1232 6 ай бұрын
Anyone else unable to access a codewithmosh course that they bought? It just brings me to the source code :(
@feelsthevibes1662
@feelsthevibes1662 5 ай бұрын
Theme?
@benemma5602
@benemma5602 6 ай бұрын
don't know what all the fuss is about... server actions are an absolute game changer. The implementation is so clean that I'm starting to wonder why it took so long to write code backend functions that way.
@adambickford8720
@adambickford8720 6 ай бұрын
It didn't, we learned 20 years ago this idea is dumb.
@IvanRandomDude
@IvanRandomDude 6 ай бұрын
Took us so long? "action" form attribute has been part of standard HTML since late 90s lol
@Sammy2100
@Sammy2100 6 ай бұрын
@@adambickford8720 , yes, we were told it was dumb 20 years ago. It reminds me so much of classic ASP/PHP with jQuery
@smwnl9072
@smwnl9072 6 ай бұрын
I think if you inter mingle code of different concerns, isolated component testing is an issue. But I probably don't know enough about this to comment. Or maybe this was already addressed.
@LokeshKumar-tk7ri
@LokeshKumar-tk7ri 6 ай бұрын
Do you think that AI is going to replace web developers
@VibeThemes
@VibeThemes 5 ай бұрын
Server actions makes development faster.
@kaustav07
@kaustav07 6 ай бұрын
Your VS Code theme?
@noonenoone5121
@noonenoone5121 6 ай бұрын
You changed your shirt!
@binamralamsal
@binamralamsal 6 ай бұрын
Many people are ignoring the fact that you can simply put the server code in another file and import it wherever you want. This code was shortened to be shown in the conference. Edit: And I liked how you explained in the video.
@spacecore2077
@spacecore2077 6 ай бұрын
Yup! Also it's perfectly safe!
@maskman4821
@maskman4821 6 ай бұрын
For example: --- src/actions/add-bookmark.js --- "use server" export async function addBookmark({ slug }) { await use sql `INSERT INTO bookmarks (slug) VALUES (${slug});` } --- src/components/Bookmark.jsx --- import { addBookmark } from '@/actions/add-bookmark' import BookmarkIcon from xxxxx export default function Bookmark({ slug }) { return ( addBookmark(slug)}> ) } 🤗🤗
@misterbatch4517
@misterbatch4517 6 ай бұрын
the best online teatcher
@ionelCristianLupu_
@ionelCristianLupu_ 6 ай бұрын
Finally someone that understands the bigger picture. Thank you Mosh! Best practices are made to be challenged and changed with time in favor of other new best practices. All of those that hate the direction where NextJS is going are just ignorant and they don't want to admit it.
@raghavenderkuppireddy7158
@raghavenderkuppireddy7158 6 ай бұрын
Hi Mosh ❤
@kcsiddhartha
@kcsiddhartha 6 ай бұрын
Why is it live but not live actually
@binamralamsal
@binamralamsal 6 ай бұрын
It's called premiere. It's just a pre-recorded video.
@jasonliu6321
@jasonliu6321 6 ай бұрын
I still don't really understand the true meaning and significance of server actions. According to Next.js's official docs, its role is to handle data mutation. But my question is, what is the actual practical meaning of handling data mutation on the frontend? If the data mutation here only covers simple scenarios like SQL, sending email, generating PDFs, then there is not much real significance. Because such scenarios are unable to cover most of the backend development use cases. There are many more complex scenarios that backend development needs to handle. I won't list examples here, because there are too many. So, can someone explain what is the true practical meaning of server actions? If we think server actions can make up for their limitations by calling backend APIs, then I find it even more bizarre, because you can call backend APIs the same way without server actions anyway. If Next.js thinks it can become a full stack framework through this approach, then I feel this vision is unrealistic, because the backend scenarios it can handle are too few.
@moshfeghhamedani
@moshfeghhamedani 6 ай бұрын
Did you watch the video to the end? I’ve clearly explained the role of server actions.
@shqnz
@shqnz 6 ай бұрын
Used to follow this guy when he had no beard 😮
@theintjengineer
@theintjengineer 6 ай бұрын
_You shouldn't write SQL there and should use an ORM Tool like Prisma_ I mean, I know SQL. I don't see why I shouldn't write it😂😂 What is the argument against that? Anyways... And if I were to use something else, I'd probably go for Drizzle.
@navascrisis4626
@navascrisis4626 6 ай бұрын
"20 yrs ago when I was still coding in Assembly", lol😂
@okkneha
@okkneha Ай бұрын
@mehamada1
@mehamada1 4 ай бұрын
Dotnet is all and everything
@birsingh5388
@birsingh5388 6 ай бұрын
Vercel going to make web applications so easy
@georgezimmer5622
@georgezimmer5622 6 ай бұрын
For only 20$ / month and being vendor locked isn't that wonderful ? Next is no longer a framework it's a product.
@krishnask3386
@krishnask3386 6 ай бұрын
Hi Mosh
@thekenapp535
@thekenapp535 4 ай бұрын
I see laravel livewire in this
@sauravkumarjha2838
@sauravkumarjha2838 6 ай бұрын
improved PHP 😄 ?
@vbtux1
@vbtux1 6 ай бұрын
آفرین موش
@DamnBoii123
@DamnBoii123 6 ай бұрын
Woah I didn't recognise you. You got a beard and a moustache
@umarahmed6443
@umarahmed6443 6 ай бұрын
🤣🤣
@thepromaster7868
@thepromaster7868 6 ай бұрын
I still can't see the difference between programming and coding
@HeyMr.OO7
@HeyMr.OO7 6 ай бұрын
So coding is any lines of code or logic that you wrote. Say, sum of X n Y Programming is to build something useful using coding. Like building a calculator, an Android app or a website.
@michaelnwuju6368
@michaelnwuju6368 6 ай бұрын
Nice take on this, but I still think it's not the right way, it defeats the whole division between Frontend and Backend. Even though it removes the redundancy of writing trivial code, we still need that redundancy to be there to maintain balance. 😂 Now please I'd love to see you do something on cloud engineering. 🤲🏽
@venkatakrishnanramachandra6325
@venkatakrishnanramachandra6325 6 ай бұрын
Gurunathaaaaaaaaa ❤️❤️❤️❤️❤️🌹🌹🌹🌹🌹🫶🏼🫶🏼🫶🏼🫶🏼🫶🏼🫶🏼
@user-jx7nu4fo5y
@user-jx7nu4fo5y 6 ай бұрын
ماش عشق منی ❤❤❤
@kasper369
@kasper369 6 ай бұрын
Goes to show that most of the community does not read the doc and dont know the fundamentals
@ethereal41
@ethereal41 Ай бұрын
Not enough people have seen this video. I love what next js is doing and I hope they improve, but if they continue receiving hate from uninformed people, they might just evolve backwards, removing functionality.
@xXLeGrandStanXx
@xXLeGrandStanXx 6 ай бұрын
@mahekjariwala3560
@mahekjariwala3560 6 ай бұрын
It seems like Next.js is trying copy remix concepts like action method.
@samueltaub
@samueltaub 6 ай бұрын
With this new focus on software development Everybody should be full stack. The answer if we are front or back will have no sense
@sethswenson1321
@sethswenson1321 6 ай бұрын
they probably said the same about development, ops, and security, and look where that got us...
@guled669
@guled669 6 ай бұрын
This is called headache programming, trust me on this one unless you want to go fully bald really really soon don't go down this path.
@haiffy
@haiffy 6 ай бұрын
Well he's already bald
@oyinlolaolasunkanmi
@oyinlolaolasunkanmi 6 ай бұрын
Your argument isnt valid Mosh. With this kind of school of thought, we will be churning out incompetent engineer who do not understand the true nature and art of software engineering.
@moshfeghhamedani
@moshfeghhamedani 6 ай бұрын
How much do you know about what happens under the hood when a function calls another function? Does that make you less of a software engineer?
@mehdieskandari5608
@mehdieskandari5608 6 ай бұрын
Great
@mehdieskandari5608
@mehdieskandari5608 6 ай бұрын
Eyval Mosh
@sorcerer2608
@sorcerer2608 6 ай бұрын
خخ ایرانی هستی توهم
@lemoniahoffmann8401
@lemoniahoffmann8401 6 ай бұрын
Snake oil salesman
@ximenescoutinho_
@ximenescoutinho_ 6 ай бұрын
Hi Mosh
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 305 М.
Uma Ki Super Power To Dekho 😂
00:15
Uma Bai
Рет қаралды 35 МЛН
Зу-зу Күлпәш. Көрінбейтін адам. (4-бөлім)
54:41
Is Coding Still Worth Learning in 2024?
9:33
Programming with Mosh
Рет қаралды 157 М.
Finally Fix Your Issues With JS/React Memory Management 😤
20:13
Jack Herrington
Рет қаралды 75 М.
Every CSS Animation property
9:26
chunkydotdev
Рет қаралды 45 М.
Programming Is NOT Enough | Add these 7 skills…
13:19
Travis Media
Рет қаралды 408 М.
Python for Beginners - Learn Python in 1 Hour
1:00:06
Programming with Mosh
Рет қаралды 16 МЛН
React vs Angular vs Vue: What to Choose for Your Next Project
11:40
Programming with Mosh
Рет қаралды 190 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 443 М.
Why to learn Cloud and DevOps
16:55
Hitesh Choudhary
Рет қаралды 41 М.
Level Up Your VSCode Game: 5 Must-know Shortcuts
4:07
Programming with Mosh
Рет қаралды 24 М.