Тёмный
Kevin Ghadyani - JavaScript
Kevin Ghadyani - JavaScript
Kevin Ghadyani - JavaScript
Подписаться
See what real coding is actually like for a professional who works on real products!
FizzBuzz in DISGUISE #CodeWars
12:41
Год назад
What Microsoft did with my code...
1:14:06
Год назад
Комментарии
@minhquoctran9146
@minhquoctran9146 16 часов назад
Your work are truly amazing! I known about compound component a couple months ago, I think it's really cool concept till I watched this video that you show even cooler concept. Thank!
@drrodopszin
@drrodopszin 2 дня назад
Isn't "React designed right" SolidJS in reality?
@KevinGhadyani
@KevinGhadyani 2 дня назад
Exactly! I'm in the React world by career choice, but I've been a huge fan of Solid JS by Ryan Carniato! He had the right idea.
@justAbeautifulSoul409
@justAbeautifulSoul409 7 дней назад
ONE OF THE BESTEXPLANATION THABK YOU❤
@AJMichels
@AJMichels 16 дней назад
Nice video. It is inaccurate to say the original commits are “deleted” when performing a rebase. They still exist and can be accessed and even recovered if you know their original hashes. They do end up in an orphaned state and can be “cleaned up” under certain circumstances in the future.
@DarrylHebbes
@DarrylHebbes 19 дней назад
I took a look through the Fluent UI codebase, what a nightmare, need a degree to orientate oneself
@frozen_tortus
@frozen_tortus Месяц назад
wooa what a video!
@mashab9129
@mashab9129 Месяц назад
great talk! 🔥
@classicdrumpercussion1608
@classicdrumpercussion1608 Месяц назад
wow, arrr.map(Boolean) i loved this practice, thanks
@SzybkieSzociki
@SzybkieSzociki 2 месяца назад
First js vido in my life that i actually enjoyd.
@Jessyco
@Jessyco 2 месяца назад
This was a great example and use case, thank you!
@AlphaHydrae
@AlphaHydrae 2 месяца назад
This is great, what I don't quite get is how does the <ModalTrigger> make the <button> inside it trigger the event needed for the logic of the modal? Does it clone the child with an extra onClick prop inserted somehow?
@KevinGhadyani
@KevinGhadyani 2 месяца назад
Exactly!
@pranavdhamanage
@pranavdhamanage 3 месяца назад
I love the way you have dived deep into design patterns, but one main thing I am unsure about is that in the docs react team has mentioned not to use cloneElement and they have deprecated the api as well . So what’s your take on that? Would love to hear
@KevinGhadyani
@KevinGhadyani 3 месяца назад
The React team doesn't necessarily support all use cases, but many libraries use `cloneElement` internally. I've been looking at alternatives for a while now because I never liked how this was invisible and difficult to enforce in TypeScript. On the other hand, I figured out how to make render props fit my needs with memoization. Months later, in an interview with a Microsoft dev, he pointed out I could use useCallback and get a similar effect! It's not exactly the same, but it fixes my biggest gripe of render props. Another friend pointed out you could wrap these component functions to create new ones that had the functionality you wanted built-in. Where I work right now, they wanted render props with useCallback, so that's what I have. I haven't experimented with new ways to fix this since, but I'm sure there will be better ways in the future.
@soumyamondal
@soumyamondal 3 месяца назад
I'll definitely share this one, truly amazing content.
@keelangibb565
@keelangibb565 3 месяца назад
Hey man this is a gold mine of information. Keep it up. You should do more videos in this style with the slides. The way I learn most is when I get a short explanation of what a library/concept is first, why you need it, and why you should care. Then I like seeing an actual concrete example of how things are done using framework/example A and how the equivalent thing is done in framework/example B. Then I have the full context and can actually understand how example B solves the problems in example A and why I should even care in the first place. (think class + lifecycle vs function + hooks). This way you can gradually build on example A and B as you continue through the video and you can also isolate sections of code from example A, B or even C without needing to give full context of each to get your point across. I think this way is pretty digestible for most people and it makes sure the viewer is not lost in the middle of an explanation and they can discover why something is so elegant themselves. Anyways, liked and subbed hope to see more soon.
@KevinGhadyani
@KevinGhadyani 3 месяца назад
Thanks so much! I'd love to do more of these. I even have one ready on TypeScript but haven't had time to put it up yet (3 kids now) These styles of video take two weeks to create including all weekend and also time practicing my ad libs. Really glad you like the production value!
@keelangibb565
@keelangibb565 3 месяца назад
@@KevinGhadyani Yeah no worries I know it can get chaotic. I do have a few questions though. 1. What’s your stance on server components? Does this model still work with all the context? I’m assuming a lot of them would need to be client components to work to track the state. 2. You briefly mentioned jotai. Could you use it instead of context? 3. Opinion on tailwind now that it has exploded in popularity. I’ve personally used it for a few years now and couldn’t imagine styling an app without it or a solution very similar it. Shadcn/ui which runs on radix is also incredible to use and it looks like it uses a similar pattern you describe in the video. Would you call that children first?
@KevinGhadyani
@KevinGhadyani 3 месяца назад
​@@keelangibb565 For #1, server components can track state too. The server keeps the HTML loading in the background and throws JS it generates at the client. That's how it works. So if you have state, it should retain in server components. Am I missing something? That's what my original exploration showed when I first tested it out in a different video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6R_r6AqscqQ.html&pp=ygUbcmVhY3QgMTggc3NyIGtldmluIGdoYWR5YW5p #2 YES! I've actually used Jotai 4 times now in place of context. If I need global context, I use Jotai. It's like Redux in that it's not tied to React, so you can use it to write your own logic and associate multiple frameworks or multiple React instances. This is very common with micro frontends. #3 My opinion on Tailwind hasn't changed except on one point (I'll say at the end). If you write your HTML with Tailwind classes, you're doing it wrong. You need to write Tailwind like you're writing Emotion CSS (which you shouldn't be writing inline if you want your render code to be readable). Make it type-safe (which is super difficult to do in VSCode when it's not inline) and add some helper functions so it's easy to do line-by-line (function args) rather than a stupidly long string of random classes. There are so many gotchas! Vanilla Tailwind sucks and leads to the same problems I dealt with at a marketing site job in 2012 where you literally couldn't tell what was going on with the CSS or the HTML. YUCK! I absolutely don't recommend it if you're writing HTML like it's 1994. Also, unless you're using Vite, it's tricky to get Tailwind setup correctly. You have to purge out classnames from the final compiled output or your bundle jumps up 4MB. Lastly, you cannot use Tailwind classnames. This is why you _need_ helper functions or something similar. Tailwind classnames have to be namespaced you absolutely will run into the same Global CSS issue everyone runs into when you try to scale your site or upgrade something (like the Tailwind version) or change one style in one place of the Tailwind config and hope it doesn't globally affect your whole app. I am constantly dealing with micro frontends, and all of those have different CSS considerations based on the version of the component library they're running. If Tailwind isn't namespaced, they'll all share the same Global CSS, so when certain micro apps appear on the page at the same time, it could lead to different outcomes depending on which are loading when. Good luck debugging that! It will take WEEKS. And the problems will change over time as different apps add changes. So in conclusion, yes, you can use Tailwind, but I think you need to do a lot of work to make it feasible. I would absolutely never use it out-of-the-box. And so you know, I've done 2 Tailwind projects so far successfully on side jobs, so I'm speaking from experience.
@eukursg
@eukursg 3 месяца назад
IMHO the technical part of explaining what is props and children was good. The part that's crazy to me is the obsession to make things more complicated that it needs to be. The take in this video is that you should take the responsibility that the other devs gonna produce bad code and the solution is to write a complex and difficult to read code to mitigate it.
@KevinGhadyani
@KevinGhadyani 3 месяца назад
I'm not exactly sure I understand your point, but I'll respond the best I can :). I take a different approach at each company I go to based on the needs of the org and the existing codebase. This is just one solution you can use to solve the problem of tight coupling, but not something that works everywhere you go. In general though, the more complex your library, the less complex the code consumers need when consuming it. Where I work now, I have a different approach than this video. Instead of component usage freedom, they want API stability and ease-of-use. Now we're creating one component for each feature rather than a bunch of them that you assemble because that follows the design system better (unlike the patterns I had at this other company). It's a 180 degree difference in component design. The goal of TypeScript and other coding patterns is to make it dead simple to write code the intended way, so other devs can't screw it up.
@DarrylHebbes
@DarrylHebbes 3 месяца назад
This guy is smart but could benefit from pausing after delivering a point, allowing a second or two to let the ideas sink in
@KevinGhadyani
@KevinGhadyani 3 месяца назад
My bad. That's probably partly on my editing and partly on the fact that I'm a fast talker in general. Newer videos have a different editor. He helps make things sound more natural, but I'd recorded and edited this one before I hired him.
@SarShaGaming
@SarShaGaming 3 месяца назад
This was AWESOME! thank you
@Moopafoop
@Moopafoop 4 месяца назад
Heya, found your talks during some downtime, and have been enjoying. I wanted to ask about the ref solution at 33:24 and I guess useEffect in general. From my experience, useEffect is really for syncing react with something external outside of react. Given a callback like onChange I'd just call it from the event handler that's updating calculatedValue versus waiting for useEffect to run when calculatedValue changed. This video is pretty old now too, so you may have changed the way you use useEffect. The useRef solution to ensure onChange is up-to-date without needing to include it as a dependency or memoize the incoming prop in the parent is interesting to me. Is this solution only intended for when you want useEffect to run under very specific circumstances? I could see someone finding this and doing something weird like wanting to do a fetch 'on mount' but only on mount so they ref all the potential props needed for that useEffect performing the fetch. I'm not saying you're wrong, but I'm trying to understand the value of what feels like bypassing the dependency list
@KevinGhadyani
@KevinGhadyani 4 месяца назад
I've changed how I do the useEffect useCallback thing mainly because React has changed. They fixed a bug where state setters would error when used after the component unmounts. In terms of useRef, it's powerful and needs to be done with care, but there are some situations where it's required.
@DarrylHebbes
@DarrylHebbes 4 месяца назад
I think I am fairly smart but I had to watch this twice to grasp the concept, and that is with 8 years React experience, I tried slowing it down to 0.75 speed but it makes you sound drunk... lol. Thanks though... I am sure after a good nights rest it will make sense. I am always bemoaning counter increment examples, now I wish there was one. Perhaps I will just try it out myself.
@wvovaw3052
@wvovaw3052 4 месяца назад
This is what real HTML programming looks like!
@THEShAdOwHFV
@THEShAdOwHFV 4 месяца назад
Great video, thanks for the info!
@monarchgam3r
@monarchgam3r 4 месяца назад
wish there was more source code for some of this
@KevinGhadyani
@KevinGhadyani 4 месяца назад
I have it linked in the description I thought. Are you looking for something else?
@mayank_m_jain_1160
@mayank_m_jain_1160 4 месяца назад
Great Video ! Thanks SIr !
@user-ru8hn9hb5c
@user-ru8hn9hb5c 4 месяца назад
First 10 minutes: never heard components explained better
@KevinGhadyani
@KevinGhadyani 4 месяца назад
Man, that's great to hear thanks! ;)
@mks-h
@mks-h 4 месяца назад
I've been searching for content to improve my shitty React codebase, and out of about 10 way more popular videos, this is the first one with some actual content. Others just tell something basic without any convincing. But your video is so much better! A bit long, so I'll watch the rest later, plus I see you left long answers to comments, which I'll obv have to read now. But for now, thanks!
@KevinGhadyani
@KevinGhadyani 4 месяца назад
Hope the rest helps you out! There are different ways to approach React components. I was aiming to fix tight coupling. In a later video I did with another group at Microsoft with a similar pattern, I also tried renderProps + useCallback, but it adds indirection. I use that pattern at my current job though. I came up with a way to do children-first with TypeScript and clever use of generics, but it requires some thought to figure out.
@muatasimahmed2343
@muatasimahmed2343 4 месяца назад
is project over ?
@KevinGhadyani
@KevinGhadyani 4 месяца назад
Yeah, but I have more videos, just haven't pushed them up yet. 42 total.
@ShivamMishra-mn6cs
@ShivamMishra-mn6cs 5 месяцев назад
At 7:17 you mention updating a specific cell using hook can you example how can i achieve that and thanks for the video
@behm2211
@behm2211 5 месяцев назад
Ingenious ❤
@jmmmmmmmmmk
@jmmmmmmmmmk 5 месяцев назад
Thx very good video
@satendrakumar1768
@satendrakumar1768 5 месяцев назад
Hello, I am not able to see the Redux tab next to the React tab. Also when using react tab it sows Timeout while inspection. I tried several time but same result. I check all the possibilities but same result. Can you please help me with this ? thank you
@TheArmanist
@TheArmanist 5 месяцев назад
Great explanation, thanks
@rotvein4629
@rotvein4629 5 месяцев назад
For me it seems more obvious and simple just to add to the `fontSized` object a property `__proto__: legacyFontSizes`. Then `extreaLagre` and `extraSmall` won't appear by iteration, but not break the legacy code as e.g. with an attempt of getting `extraSmall` the `gigantic` will be returned. I still find your video very clear-cut and helpful, thank you! But can you please answer if in this particular case my solution is inferior to the approach with `Proxy`?
@KevinGhadyani
@KevinGhadyani 5 месяцев назад
That's a great idea and a lot simpler! Personally, I wouldn't depend on proto as that's like black magic; unless I'm missing the mark. It's got that code smell. You also need to check for existing values first too. Hmm 🤔.
@coffeeandtalk
@coffeeandtalk 6 месяцев назад
whole 25 minutes, still don't know why use redux over context lmao
@KevinGhadyani
@KevinGhadyani 6 месяцев назад
It's been a while since I watched this. I might've named it wrong or misremembered when creating the upload. This was definitely one of our topics when I talked to Marc though.
@coffeeandtalk
@coffeeandtalk 6 месяцев назад
@@KevinGhadyani i will listen to it again, thank you
@KevinGhadyani
@KevinGhadyani 6 месяцев назад
@coffeeandtalk this interview was broken up into 5 videos, I think, so it may have been in another one from this same group. That's what I mean.
@coffeeandtalk
@coffeeandtalk 6 месяцев назад
@@KevinGhadyani the other parts are still on your channel or where do I find them? Because I can use both redux and context but to be a good engineer I want to understand when to use which and not just apply blindly redux for everything
@KevinGhadyani
@KevinGhadyani 6 месяцев назад
@coffeeandtalk it's really one of those "do what's best for your team on your project" situations. When I used Redux in the past, I did all Redux. This was before React Context was exposed cleanly to components. After React Context, I only used React Context because I prefer localized states. You can also use `useReducer` to make Redux-style with React Context. I still use Redux for state sharing between different JS frameworks or for backend code (yes, it works in Node without React).
@StefanStefanov-uv2db
@StefanStefanov-uv2db 6 месяцев назад
Very nice tutorial! Definitely an underrated channel..
@behm2211
@behm2211 6 месяцев назад
So true 👍
@jeffersonwillian4144
@jeffersonwillian4144 7 месяцев назад
Nice video, awesome tool, i was searching for something for debugging but this tool, go beyond! Already sharing!
@LouaiAmrouche-iu9bc
@LouaiAmrouche-iu9bc 7 месяцев назад
bro ask him to fix his tanstack table docs, they're the worst i've ever seen
@PS-dp8yg
@PS-dp8yg 8 месяцев назад
Kevin, are you going to create a course on this subject? I'm interested and don't mind helping a fellow coder by paying for a course design by you..
@KevinGhadyani
@KevinGhadyani 8 месяцев назад
I appreciate it! I'd love to make a course especially with the passive income source. Of the few courses I've tried for work, I've never gotten anything out of them, and I've never finished any either. I don't really think I'm qualified to do courses. I'd hope my RU-vid videos provide enough information.
@PS-dp8yg
@PS-dp8yg 8 месяцев назад
@@KevinGhadyani Bummer... A course on how to properly design components would be awesome. Anyway, do you have source code with all the examples above? I would like to look at them in order to learn more. Some of the stuff is just too vague. BTW, I'm pretty sure you are qualified. :D
@Spielestyler
@Spielestyler 8 месяцев назад
do you know the css to get an outline shadow on .message-text ? i only have a shadow on .message-sender and cant seem to find out why
@KevinGhadyani
@KevinGhadyani 8 месяцев назад
Yeah can use multiple comma-separated lines in box-shadow to fake it.
@codedusting
@codedusting 8 месяцев назад
Doesn't work
@user-hd7vt8rd7v
@user-hd7vt8rd7v 8 месяцев назад
Great Vedio, very helpful
@behm2211
@behm2211 8 месяцев назад
Great video 👍
@ArturZalewski
@ArturZalewski 8 месяцев назад
Nice. Currently working with the Tanstack virtualized table and it worked well, until I faced the requirement, of nesting a simple table in a virtualized row.
@KevinGhadyani
@KevinGhadyani 8 месяцев назад
I did this. You just need a custom cell for the whole row that renders a table.
@emterroso
@emterroso 9 месяцев назад
It would be nice if the video, as the title suggests, talked about Redux vs React Context. A more appropriate title would be "Chat with Mark Erikson, maintainer of the Redux ecosystem". It doesn't even link to his blog post on the subject.
@KevinGhadyani
@KevinGhadyani 9 месяцев назад
Sorry about that. That's a great idea. Did I misname the video too? I broke up our convo into multiple videos each where we talked about a different topic relating to Redux. Pretty sure this one is where we name-dropped Dan Abramov because of the Context vs Redux debate.
@emterroso
@emterroso 9 месяцев назад
@@KevinGhadyani you did mention both React Context and Dan Abramov, but it was mostly about history. I was hoping for a comparison, pros and cons, when you should choose one or the other, something like that. But there was nothing of the sort.
@KevinGhadyani
@KevinGhadyani 9 месяцев назад
Understandable.
@zacharylarson1245
@zacharylarson1245 9 месяцев назад
For clarity, transducers are to be useful in situations where you have multiple transformations in a pipeline. Like map, filter, map, ...etc, ...reduce; where each one is making potentially new intermediate datastructures upon each collection transformation. Transducers are an algorithmic way to combine all those operations into a single step on each item of your collection, and avoid making intermediate structures. If you're doing a lot of processing, it can save time and space; if you're only doing a little bit, probably stick to functional transformations. Oh, transducers were invented by Rich Hickey from Clojure. Fun to see my daily language making conceptual waves in larger ecosystems, usually without greater awareness. The future is here, just waiting for you to distribute it...
@KevinGhadyani
@KevinGhadyani 9 месяцев назад
That gives me a lot more context! Thanks for explaining the benefits!
@dboydomr
@dboydomr 10 месяцев назад
Did well under pressure, keep cooking.
@KevinGhadyani
@KevinGhadyani 10 месяцев назад
Just re-watched it. I'm surprised how simple it was. And yes, I don't like "for" loops. I have two LeetCode videos; one with RxJS (functional pipelines) and another where I did the same thing C++-style with a class. The class one took 3 times as long.
@DevCoder
@DevCoder 10 месяцев назад
Awesome video Kevin! It is a very helpful use-case. Thank you so much for this
@mgrycz
@mgrycz 10 месяцев назад
Can I ask what font do you use in the video?
@KevinGhadyani
@KevinGhadyani 10 месяцев назад
For the code of thumbnail? The code is Victor Mono, but I'm not exactly sure what it was in this video.
@thegeilobanana5540
@thegeilobanana5540 11 месяцев назад
hmmm; summary: wants to speed up js, but doesn't like for loops, so trys to explain complex concept of loops via nested functions and loop body via list of other functions, resulting in worse performance then for loop i seem to be missing something, "benchmarks dont show it, but in other cases it would be better" then pls show it - even if its "too complicated"; goal of the talk hasn't been reached / not set, i feel no reason to look at the Transducers-conzept in the future
@KevinGhadyani
@KevinGhadyani 11 месяцев назад
Sorry about that. It can be tough to come up with examples for an hour-long talk. Showing tons of code on slides is difficult because I can't use proprietary code, and all the crazy transducer stuff ends up being full apps, so it's not easily available. Without building a complete app, it's tough to explain. I'll keep this in mind next time I do something. You're right, these simple tests aren't fully utilizing transducers.
@naveenkumaravelmurugaian4891
@naveenkumaravelmurugaian4891 11 месяцев назад
Hi @kevin Ghadyani, I'm getting hydration error while configuring the next.config.js file in next.js 13.4 application(app folder), how can I fix that?
@KevinGhadyani
@KevinGhadyani 11 месяцев назад
Hi! Thanks for your message! I'm not familiar with Next, so I'd recommend asking in StackOverflow or join Zach's Slack for Module Federation.
@naveenkumaravelmurugaian4891
@naveenkumaravelmurugaian4891 11 месяцев назад
@@KevinGhadyani sure Kevin, I have raised an issue in GitHub but didn't got any reply from anyone. If you have any other link to connect with them, please share it with me
@KevinGhadyani
@KevinGhadyani 11 месяцев назад
I haven't looked in a while, but Zach has a Slack where you can ask about Module Federation.
@bharat_singh56
@bharat_singh56 10 месяцев назад
Hi @naveenkumaravelmurugaian4891, Module federation does not support NextJS 13.4 app router yet
@naveenkumaravelmurugaian4891
@naveenkumaravelmurugaian4891 10 месяцев назад
@@bharat_singh56 yeah Bharat, anyway we switched to pages structure