Refactoring a React Component (Design Patterns)

  Рет қаралды 16,621

Cosden Solutions

Cosden Solutions

Күн бұрын

Пікірлер
@jaimishtrivedi392
@jaimishtrivedi392 3 ай бұрын
In the last... The TextInput component you were using were actually wrapped inside div, and if you pass className 50% to input, you would get the half width of that div, previously you were directly using inputs inside parent div, you have to give 50% width to align those two inputs. But now you don't need it, or you have to provide full width 👍
@rodicabalan6565
@rodicabalan6565 3 ай бұрын
We need more refactoring videos! Thanks for the effort❤
@MickDavies
@MickDavies 3 ай бұрын
Coming from Vue since 2017 and having to upskill in React this year for work, loving your tutorials! The tempo is perfect for me and learned a few new tricks such as the ComponentProps and just love watching how others refactor, it's sped up my React journey learning this way.
@teknolovedigital
@teknolovedigital 3 ай бұрын
Why you switch from vue to react?
@MickDavies
@MickDavies 3 ай бұрын
@@teknolovedigital companies and that was the new tech stack. Nextjs + react. Good to learn new stuff, Vue is superior but I feel confident in both now which is always good for job prospects. I've been doing this for a while now... 15 odd years
@danieldefoe2981
@danieldefoe2981 3 ай бұрын
Hi, Cosden, thank you for your videos. I want to point out that in 10:05 you should've used a generic instead of any. Just make your component a generic component and pass generic value to the Props
@SK_Covers
@SK_Covers 3 ай бұрын
Broo ❤❤❤ Just watched your React hook form + zod video. Very clear very concise, very understanding, straight to the point. At last it's very very beginner friendly 💯😎🔥 Love from India ❤
@dr_jacko
@dr_jacko 3 ай бұрын
1 minor niggle with this is that your TextInput is closely coupled with react-hook-form. If I were approaching this, I would either create a TextInput with more generic handlers and values and pass in the relevant functions and values or rename the component to RhfTextInput or similar.
@cosdensolutions
@cosdensolutions 3 ай бұрын
Fair, I found myself rarely needing a text input without an attached form in a project, but if you do then yeah definitely
@TannerBarcelos
@TannerBarcelos 3 ай бұрын
@@cosdensolutionsgreat counterpoint. When I take a step back and think about it, all of my inputs in the products I work on are in a form for proper semantic html, so I’d use this approach as well. It would also enforce consistency in the codebase by forcing others to not only use the reusable component, but always remember to rely on RHF wherever they need to build features that require text inputs. QQ: Have you looked into Tanstack Form? It looks amazing but I’ve yet to try it as it’s not production ready. Once it is, I want to migrate off basic forms and inputs in my product at work to use TSF. (I don’t even use RHF now because of this exact reason; I want to use TSF and don’t want to do 2 refactors so I decided to not use a form library at all up front)
@farrelbatykouima7494
@farrelbatykouima7494 Ай бұрын
We need more videos like that one!
@nikawuladze953
@nikawuladze953 3 ай бұрын
This type of videos are sk useful. Ty for that ❤ .
@spizer98
@spizer98 3 ай бұрын
wooooooow amazing content, expecting more on future❤
@MattElisa97
@MattElisa97 3 ай бұрын
I love this style of code refactoring video. Just a tiny bit slower and it would be perfect. But I love it !! thanks
@royangagas2519
@royangagas2519 3 ай бұрын
Very clear explanation, I love it
@ericng3673
@ericng3673 3 ай бұрын
Instead of passing control, usually I prefer using useFormContext and add a FormProvider. This doesn't work well if you have multiple forms components as siblings though. Performance wise I am not sure if it is optimized as well
@lupaco26
@lupaco26 3 ай бұрын
That's great my friend!
@jorgevillafraz2656
@jorgevillafraz2656 3 ай бұрын
Excellent video 🎉
@RonnieDenzel
@RonnieDenzel 3 ай бұрын
I think the red squiggly lines coming from accessing the name key in the errors object is due to the key being a defined value and not the key itself,so typescript throws an expected error as it has no idea such a key is defined or exists However,the JS works fine as the functionality is the same,so to tackle this i usually assert the value to a type,but i didnt know you can get the tostring value of it😂
@tomvj15
@tomvj15 3 ай бұрын
Your videos are very easy to understand I like your way of Teaching and I would like to enroll your "Project React" course, I am from India right now i don't have a full amount for this course did I get any coupon code from your "Cosden Solution" it will help me lot , Thanks for providing a wonderful content about React keep rocking....!
@alenomer3968
@alenomer3968 3 ай бұрын
Nice video again 👏👍
@brNoMundo123
@brNoMundo123 3 ай бұрын
Great video! Thank you ❤
@ptolemyhenson6838
@ptolemyhenson6838 3 ай бұрын
Doesn't React Hook Form have a hook specifically made for handling arrays (something like "useFieldArray" if I remember right)? I thought this tutorial would include that.
@cosdensolutions
@cosdensolutions 3 ай бұрын
ahh it does, didn't know about it until now. thanks!
@OO-jm5qq
@OO-jm5qq Ай бұрын
這部影片太他媽的讚了
@garudaputro
@garudaputro Ай бұрын
Would you please make video about S.O.L.I.D pricple in react it's will be useful for us to be more profesional 😁
@ajiteshmishra0005
@ajiteshmishra0005 3 ай бұрын
Can you create an exclusive video on Design Pattern required for ReactJS Developer for developing UI with efficient working.
@gauravbawa5609
@gauravbawa5609 3 ай бұрын
@codesen I tried to subscribe for your newsletter however, it keep showing alert for error.
@0GERA0
@0GERA0 3 ай бұрын
would you recommend zustand instead of redux? why, would you make a video of differents state managements (Y), thanks
@Deus-lo-Vuilt
@Deus-lo-Vuilt 3 ай бұрын
Good stuff, a like and sub!
@justin9494
@justin9494 3 ай бұрын
thanksssssss
@n00berdoober
@n00berdoober 3 ай бұрын
Can you please tell, which extension you used for "rjfcp" snippet at 8:40 ? I can't find it in marketplace
@cosdensolutions
@cosdensolutions 3 ай бұрын
my own custom snipper, check out my vscode setup video!
@n00berdoober
@n00berdoober 3 ай бұрын
@@cosdensolutions Awesome ❤
@kalideb-y3y
@kalideb-y3y 3 ай бұрын
should I not use "any" in typescript no matter what? for example in real world project
@jason.zubiate
@jason.zubiate 3 ай бұрын
whats the shortcut extension
@griffin955
@griffin955 3 ай бұрын
Hi, what VSCode extensions are you currently using for your tsx files to infer the remainder of the line you're writing so you an autocomplete it?
@ptolemyhenson6838
@ptolemyhenson6838 3 ай бұрын
I'm pretty sure that's GitHub Copilot.
@griffin955
@griffin955 3 ай бұрын
@@ptolemyhenson6838 So he is using Copilot during his video tutorials?
@usman_ghanni
@usman_ghanni 3 ай бұрын
he mentioned somewhere "CoPilot" here at 15:27
@shahwaizkarim-h9z
@shahwaizkarim-h9z 28 күн бұрын
what would happen if we have passed register as a prop instead of control. like {...register(name)}.
@matchu-pitchu
@matchu-pitchu 3 ай бұрын
The fallback empty array for the deps parameter of useKeyDown is not a good idea. Because if no deps are provided, then for every re-render a new empty array as fallback is recreated and the useEffect is unnecessarily executed.
@cosdensolutions
@cosdensolutions 3 ай бұрын
Passing an empty array to useEffect doesn't cause it to re-render! It will then just run once since it has no deps. If you pass nothing at all, then it runs every render
@matchu-pitchu
@matchu-pitchu 3 ай бұрын
@@cosdensolutions You are right. I looked at it wrong, I thought you were going to use `[deps]`, then it would have been a problem.
@HolySl0w
@HolySl0w 3 ай бұрын
Great video, love it. paced right but i wanna be _THAT GUY_ ... i don't think there are any design pattern in this video. There are best practices, SOLID principles, dependency injection but no design pattern :( that was too much of a clickbait with "the cool word cool coders say" to me. but again... good video, good infos, good stuff.
@cosdensolutions
@cosdensolutions 3 ай бұрын
Honestly, if you do a quick Google for design patterns, stuff like this comes up. I'd put SOLID principles in that too since it affects how you structure your project and components/hooks. I don't think there is one definition of design patterns in React otherwise I would've done exactly that 😁
@lokeshkavisth
@lokeshkavisth 3 ай бұрын
First😍
Refactoring a React component - Design Patterns
15:19
Cosden Solutions
Рет қаралды 99 М.
Combining Zustand with React Query
20:24
Cosden Solutions
Рет қаралды 27 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 36 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
File Uploads in React (Complete Tutorial)
25:31
Cosden Solutions
Рет қаралды 11 М.
3 Powerful Design Patterns You Should Know
14:26
Amichai Mantinband
Рет қаралды 12 М.
React Clean Code - React and Design Pattern
57:09
I Code It
Рет қаралды 5 М.
The Best Pattern for Conditional Hooks in React
13:34
Cosden Solutions
Рет қаралды 23 М.
The Best React Code I Wrote (Code Review)
24:50
Cosden Solutions
Рет қаралды 30 М.
Compound Components in React (Design Patterns)
18:21
Cosden Solutions
Рет қаралды 47 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
Live refactoring a subscriber's React code
32:32
Web Dev Cody
Рет қаралды 116 М.
The Most Important Design Pattern in React
35:04
Cosden Solutions
Рет қаралды 106 М.
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 36 МЛН