📬Do you want DAILY coding problems sent DIRECTLY to your Inbox? (with solutions the next day) 👉 links.papareact.com/university
@serenity-symphony3 жыл бұрын
Sony, you have mentored me in this career. highly appreciate you.
@shreyasp47893 жыл бұрын
Functional based components is a winner. If you want to use class based components instead of going to react they can go for angular or vue
@alexkonstantinov42563 жыл бұрын
Agree, I have never seen a scenario where a class component can be useful after the introduction of hooks.
@munandisichali6053 жыл бұрын
I agree but for more information there are no classes in vue lol
@lucasrodrigues97663 жыл бұрын
But you have to learn it since you will encounter projects that you will have to deal with that use class components
@alexkonstantinov42563 жыл бұрын
@@lucasrodrigues9766 man, we should know class components for sure to work with legacy projects. But please don’t use class components in new projects.
@mrcrypticx12 жыл бұрын
Agreed!
@meetshah44323 жыл бұрын
For almost a year now, I have never used class components. I just don't feel the need to use them anywhere. Functional components can do everything now that a class component can do. Also React's new docs will also replace all class components with functional.
@TheSoulCrisis Жыл бұрын
Yeah functional components seems to be the future to me. I have a buddy who works for a private tech company and he usually does functional components now.
@Native-Coder2 жыл бұрын
I write everything as class components. IDK why, but the component life cycle is more clear and makes more sense to me in a class than in a function.
@md.mehedihasan8003 жыл бұрын
I am from Bangladesh, one of the greatest programmers of all time. I like your projects very much.
@mikolots2 жыл бұрын
Dude is one of the best dev teachers there is!
@aengtech2 жыл бұрын
I had an argument on twitter. This video helps a lot. Thanks
2 жыл бұрын
An explanation if there is a difference in the re-renders between the two approaches would be nice.
@zhrgci2 жыл бұрын
Useful af, since I was following a tutorial that still used class components (while a guy on reddit said functional comp's were better)
@inspirationsemotivationtak14672 жыл бұрын
Hey can you name the channel for class based components in react
@zhrgci2 жыл бұрын
@@inspirationsemotivationtak1467 @Almighty java
@TrainYourDragon9992 жыл бұрын
i first learned react and i am coding on class component, because i like coding on class component and it makes me easy to code maybe i have not coded in functional component before
@codekicks21712 жыл бұрын
Love you bro from India, You have made this topic very easy for us, Thanks a lot
@mikedelta658 Жыл бұрын
The one and ONLY Sonny! Thank you being my energy!!!
@alwyschwuetz Жыл бұрын
And that is how I understood functional and class component in less than 16 mins guys, of course after more than a few months of learning react
@johnjohnix3 жыл бұрын
I still love using class, it is much easier when passing and updating state in a big scale project. function component is so dirty when working in a big project. Updating state from child is pain in the ass using function. Using class, you can just pass the state and you can update that state directly from child component without passing the state setter. "OR maybe I'm just missing something?"
@00804373 жыл бұрын
if you want, you can write all your states into "const [state,setState]=useState({all_your_state})" and pass only state and setState to the child component. though I am not sure if this is a good practice.
@r_yan35312 жыл бұрын
Now this is how you teach anything 👍 Clearing fundamentals first and then diving into the project making The right way.
@guitarupfront94443 жыл бұрын
i used your link just to support you I love your content and appreciate you
@lancetakiguchi97563 жыл бұрын
Really great video. That last bit of syntax, of pulling out the props, and still having that catch all props at the ends seems really clean
@salvatorebarretta14102 жыл бұрын
u're so clean! i've learned a lot of information so quick thanks!
@CavanMitchell2 жыл бұрын
wow, got a lot of clarity from this vid
@Vikingsplayer2 жыл бұрын
this is an fantastic video sir its clears some questions of class based components thanks
@isaacidibia21172 жыл бұрын
Very happy to come across this, i have been struggling to understand this, but now i do well a lot. Thanks
@RizaHariati2 жыл бұрын
I never use class components since I first learn React last year. But a lot of more senior programmer do still use the class components so I have to learn it too. But it's to 'noisy' for me. This video confirms it. Thank you ^_^
@aryandhanawade80632 жыл бұрын
React is anti-Islam !!!
@feliwein_cc3 жыл бұрын
fire content as always, could you make a shortcut vscode video? 11:55 kinda nice. hitting that 100k papa react! that seems like a pretty good christmas
@dimitritsikaridze62203 жыл бұрын
ctrl D
@ebrahim-sani3 жыл бұрын
Always love and enjoy your contents, thanks for everything 🙏
@DanyTLaw3 жыл бұрын
Thanks for the free month and great content. You are now my go to place when I eat lol
@mthoNtanzi Жыл бұрын
This is very helpful information. Really well put together.
@alamesawikanningkaton50283 жыл бұрын
Glad to see this video, i just learned react as well and confusing about which better between class and functional component. Thanks a lot sonny 😁
@subramanyashegade82483 жыл бұрын
Thumbnail is 🔥🔥
@themoadel2 жыл бұрын
love it man really you're an added value
@thatsalot35772 жыл бұрын
I know that people prefer to use functional components but as an ex-game developer class component look much simpler to me as they're a bit similar to the monobehaviour classes from unity. edit: After working for more than a year in react, I'd prefer functional components they have better features and are easier to work with.
@jsomhorst2 жыл бұрын
I really don't understand why people are so fond about functional components. To me, as a Java developer, classes are a way to accomplish this. Also the use of 'const' as being a variable is just pure nonsense. A const is a constant and not something that should be changed... just my 2 cts ;)
@latelatecheung2 жыл бұрын
why leave game industry? if I have ability to be a game programmer, I do not want go to develop web
@thatsalot35772 жыл бұрын
@@latelatecheung because I felt like being trapped inside unity, I never knew what's it's like to write low level code or something that runs on the web, I still love game development but I was really burnt out as I had to make models, textures, UI, animations, all the sounds, shaders and script for every game object all by myself, it soon started to feel overwhelming and my games were laggy af, Yeah I know I can make 2d games much faster (and as an Indie I should) but I prefer 3d games, I still make a few projects in unity and dots in my part-time but you know, I have bills to pay and learning javascript is an easy way to do that. I'm a lot mature programmer now, I may make games in my free time just not as a full time gamedev.
@thatsalot35772 жыл бұрын
@@latelatecheung and if you're thinking I should use Unreal engine or something else, then yeah I tried and it just doesn't run that good with my 8 gigs of RAM.
@latelatecheung2 жыл бұрын
@@thatsalot3577 I know you feel bro. hope you get good pay in web industry
@ashutoshpandey41713 жыл бұрын
1 million subscribers coming soon..., keep teaching sonny :)
@CodingFire3 жыл бұрын
100k Subscribers LETS GO!!! 🔥🔥🔥
@reach55932 жыл бұрын
Functional components since react hook came. It makes my life easier.
@chrisbrowning550 Жыл бұрын
Great video and nicely explained. Thank you !
@ajalasegun13 жыл бұрын
I see no reason why one would want to use class components...
@priyojitchatterjee6164 Жыл бұрын
to use the this object
@rumble1925 Жыл бұрын
Lol hooks were a mistake. I know how react codebases looked before and after hooks. After is definitely more like a nice dish of spaghetti 😂
@mayurbahuguna84383 жыл бұрын
Man you are amazing 💫 love you brother...
@raivikas2003 жыл бұрын
100K is near 🔥🔥🔥🔥.
@srinivasulurao3 жыл бұрын
Doesn't seems like enough info has been provided here about why functional components are better than class component, it's not sufficient for cracking a react interview.
@SonnySangha3 жыл бұрын
Someone call the interview police… 👮♂️
@ayasalem1745 Жыл бұрын
Bro took glasses off and i was like wow new youtuber nice
@sanTakagi-gv4dy Жыл бұрын
Explain very clear, thanks.
@saitejagatadi97112 жыл бұрын
Sonny, Could you please make a video on time management and how to avoid distractions. You are so great and master in time management.
@andyb99903 жыл бұрын
Sonny could you do a React Testing video?
@thehomeschooldev61262 жыл бұрын
Thank you. Very well taught.
@mikaelmodig51313 жыл бұрын
In the end of class era, you did not really use constructor and super. You just declared state as an object inside your class.
@osvaldogalvez47762 жыл бұрын
Thank you for the videos !
@14Shlomid Жыл бұрын
Thank you for this Video Sir. very clear, professional and helpful. so in 2023 can you suggest for new projects to use FC as the default preffered?
@mierLG3 жыл бұрын
Thank you so much for a very detailed explanation, I fully understand the difference between the two.
@danuvian2 жыл бұрын
Great video. It was explained very well.
@anonymousgerman28092 жыл бұрын
great video man
@soumyanilpodder84353 жыл бұрын
Really good video! Very helpful...❣️
@The-Dev-Ninja2 жыл бұрын
thank you!
@rohandeysarkar84433 жыл бұрын
Watched this channel grow from 5k to 100k. Way to go Sonny 🔥🔥
@salilchandwadkar7893 жыл бұрын
Awesome 🔥🔥🔥
@decathlonbo2 жыл бұрын
I think one thing that always gets missed with these discussions is Custom Hooks. Most people who are coming from Class based components have trouble seeing the value of Functional Components. I think you did a good job explaining this, but the real value in my opinion is the ability to pull out ALL of the state logic and all of your side effects into their own custom hooks which can be consumed across all of your other components. Which allows your components to only focus on the UI and not have to worry about state at all. When I demonstrate this... that is usually when the lightbulb goes off for most people. Obviously this could be handled previously in class components with HOCs or some type of service based architecture & pure components... but with Hooks, it's so much easier to do it.
@JayroJunior3 жыл бұрын
Very good content, thanks!
@trungphan25043 жыл бұрын
Nice video bro, thanks you so much
@jaygarricktheflash3 жыл бұрын
Wow! Been a bit since I watched your vids. Love the quality upgrades to the transitions and overall viewing experience. Job well done.
@riteshkhodiyar184 Жыл бұрын
You explain nicely. Just a suggestion while speaking drop the accent. for example I cant really understand when you say could and couldnt . both sound same .suggestion As non native english speaker .
@heratyian Жыл бұрын
I think both can be useful. I usually prefer class based components, especially for larger components with complex logic that track more than a few state variables.
@JayC00Ай бұрын
One of the best Videos
@darshanakv4946 Жыл бұрын
Best tutorial!
@specy_2 жыл бұрын
This doesn't really explain the advantages and disadvantages of the each. I feel like if you have a component that has some complex state or has much functionality, class components are much easier to work with, and also performance, class based components are more performant than function based ones if you are doing frequent updates. Things get even more complicated once you start to memoise things and need to add dependency arrays and stuff. I have a pretty big webapp, I've used class components for the "macro" pages, as in, the ones which handle the overall state of the whole app, then I used functional components to make all the rest. In short: use functional components if you don't re render them often and have simple state Use class components if the component is big or does many rerenders
@SonnySangha2 жыл бұрын
I disagree with your points, at a fundamental level functional components are lighter, more performant, and simpler to understand and implement than class based components. The above points you mentioned would only favour class based components if you aren’t applying them in a correct manner, this typically happens due to a lack of understanding hence defaulting to class based components. There is a reason why react defaults to functional components now and is deprecating class based lifecycle functions.
@specy_2 жыл бұрын
@@SonnySangha my webapp on normal use has up to 50 rerenders a second, the speed of the class component comes from the fact that you don't need to "re run" and build all the functions that reside in the component itself but only the render method, while function components recreate everything at every render, you could use hooks like useCallback to improve this, but that means having to manage dependencies which is kind of annoying once you get to bigger components. I'm slowly moving away from class components and moving to functional components + mobx for state management. I have to point out that for the usual website or program, function components are fine for everything, Even larger ones, mine is more of a "special case"
@decathlonbo2 жыл бұрын
@@SonnySangha There is no inherent performance benefit of Hooks over Class based components or vice versus. Both have the same performance. The React team has stated they were going to provide some features that FCs + Hooks would benefit from, but nothing has been updated in that regard. @Specy I don't think you can say that Class Components are more performant for frequent updates, and then provide ways we mitigate that in Functional Components and then say you just don't like having to manage dependencies and such. Imo, handling dependencies and doing the shallow comparison is much easier and cleaner than having to handle that in a Class lifecycle method. Long story short, FCs vs Classes really comes down to preference at this time. Neither is more performant than the other, and frequent re-renders wouldn't be a reason for why you'd choose one over the other. It's why we memoized and dependency arrays.
@eip4083 жыл бұрын
precise explanation🔥
@sambitmohanty83082 жыл бұрын
Doubt cleared Thank u
@jealousy08903 жыл бұрын
Sonny, would love to see something like a dropbox type clone, so users sign up with their own emails instead of google sign in and can upload and share files!
@binaprajapati77093 жыл бұрын
love from india dude 13 yr old here 😍
@rogerteku2877 Жыл бұрын
Use effect in functional component while cycle in class components
@zafariqbal922 жыл бұрын
Thank You!
@luqmanhrizal3 жыл бұрын
Next project: VENMO Full Stack🔵!
@jasonchen85663 жыл бұрын
Sonny is the best!
@naveenkumarkota20902 жыл бұрын
understood thank you!!
@rajeshwariy869 Жыл бұрын
Understand fully nice video make more video bro
@mounasellami1992 жыл бұрын
Thank u about this gorgeous explanation Sonny, I have question! When we will be more deep in development we use Higher Order Component ?
@byalfoster2 жыл бұрын
video start at 2:43
@АлексейАлтаев-ш4о Жыл бұрын
Good explanation, but I still don't know in which cases developer supposed to use class instead functional components (Maybe I've lost something)
@kirakira1603 жыл бұрын
Sonny the best!💪💪💪
@DevlogBill2 жыл бұрын
Hi Sonny, just found your channel by accident and you have excellent content. I just began learning React 5 days ago and I am picking it up quickly since it is functional. Before picking up React I was studying hard classes and found learning classes and creating new objects kind of confusing especially when it came to learning how to use this key word, I prefer React hooks any day of the week! Question? I am not in the tech industry yet. I am still fairly new to learning front end development. I was wondering from your personal experience, are most companies using React the new and modern way in a functional format or are most using React as a class-based system? After I get a good handle of React as function would you recommend I re learn React again but in the old way which was classes? Thanks Sonny!
@Andres_cali Жыл бұрын
Uuu and he doesn't answer
@DevlogBill Жыл бұрын
@@Andres_cali LOL I am pretty sure he got soooo many subscribers to attend too.
@empty_dayofthetech Жыл бұрын
What program do you use to draw on the screen while recording?
@JC-rv2tq2 жыл бұрын
Love this
@JustClickApprove923 жыл бұрын
I think it’s good to be aware of class based components, and understand how they work, but I can’t envisage a scope for using them over functional components. Currently in my job, I’m refactoring a react-native app written in class based components to functional components
@kaunghtethein33223 жыл бұрын
that looks like so much work
@JustClickApprove923 жыл бұрын
@@kaunghtethein3322 yeah, it’s not fun 😭
@Saradomin653 жыл бұрын
Refactoring a code is one of the most tiring thing to do in a project lmao. You have to like really be careful that all other functionalities are still working.
@b33m0s772 жыл бұрын
I learned something new. Nice eyebrows
@SonnySangha2 жыл бұрын
😉
@riz46913 жыл бұрын
Functional component is fun to use.
@Victor-wh9bs3 жыл бұрын
Good Work #PAPAFAM
@VinayKumar-1701-i7bАй бұрын
nice video sangha
@shinigami26692 жыл бұрын
I love to use functional components.
@harisamjad-pro3 жыл бұрын
Thanks bhai!
@jasonruff12703 жыл бұрын
functional components are simply superior 😈😈
@meer-cha49853 жыл бұрын
What an absolute legend
@aryan7069_3 жыл бұрын
Great video
@frankhenry10x3 жыл бұрын
Sonny is ZTFSH still live/ open for Dec?
@isurujn2 жыл бұрын
Hello, what's the tool you use to draw on screen btw? Looks cool.
@eriknilsson4994 Жыл бұрын
I think I found the program he's using. It's called ScreenBrush
@sergeydiachenko14298 ай бұрын
Great video. But Functional components is a hack inside React. The React team created this logic inside React for Class components added tons of boilerplate code. After years of using Class components, they are told for developers: "You need to use functional components". RIdiculous team. React is a mistake.
@なんでやねん-s8g3 жыл бұрын
Both are better because you didn’t use open mouth photo for the thumbnail.
@ikamy2 жыл бұрын
That was helpful
@arthurweasley58573 жыл бұрын
its almost 2022, why would you still use class components? well sometimes you need to but thats just an expection
@faikyesilyaprak87612 жыл бұрын
Clean and pure information. Quite rare in 2021. Thanks for the great effort. Keep it up!!
@zongyu1003 жыл бұрын
Hey guys anyone knows which brand is his headset? it looks really nice
@SonnySangha3 жыл бұрын
Audiotechnika!
@yuno33643 жыл бұрын
lol i was just wondering if someone would make a video about this. thanks