❤️ The React Pattern I Don't Want To Miss!

  Рет қаралды 10,053

Sakura Dev

Sakura Dev

Күн бұрын

Пікірлер: 34
@JairoPy
@JairoPy 10 ай бұрын
Arrow functions are not hoisted, so you cannot use them before initialization, that's why you used regular functions
@augustopruvost7316
@augustopruvost7316 4 ай бұрын
insightful, thank you
@SakuraDev
@SakuraDev 4 ай бұрын
@augustopruvost7316 Thank you so much 🙏.
@SimPwear84
@SimPwear84 Жыл бұрын
Beautifully explained!! Enjoyed this video a lot and just subscribbed. Can you please make more videos on React design patterns? You do it very well, thanks.
@SakuraDev
@SakuraDev Жыл бұрын
Thanks, 😊🌹, really happy you enjoyed it. Yes I put it on my list.
@giovannitonussi3746
@giovannitonussi3746 Жыл бұрын
Thanks for the video man, really helped me to accomplish this pattern.
@SakuraDev
@SakuraDev Жыл бұрын
Welcome to the channel🖐🏻, Glad it helped!
@alirezak5870
@alirezak5870 Жыл бұрын
we used primitive functions because we can't call arrow functions before initialization?
@SakuraDev
@SakuraDev Жыл бұрын
Thats true. mamnoon
@xiiEJRAM
@xiiEJRAM Жыл бұрын
Great explanation 👏🏻👏🏻
@SakuraDev
@SakuraDev Жыл бұрын
Thanks, I hope it was helpful for you 🌷
@0xtz_
@0xtz_ Жыл бұрын
i tried this in next.js 13 idk it dosdent work hh mainly it was types error, now gonna try this and thanks man u always saving my life hhh
@SakuraDev
@SakuraDev Жыл бұрын
Glad you found my videos useful.
@giovannitonussi3746
@giovannitonussi3746 Жыл бұрын
Hello friend, I also had some Typescript errors to create a Compound Table. What saved me was to change all typing to the amazing ComponentProps, imported from React. You just have to pass the Html tag like this: ComponentProps. Worked like a charm. Hope it helps.
@raphauy
@raphauy Жыл бұрын
Awesome 👏👏👏
@SakuraDev
@SakuraDev Жыл бұрын
Thanks for your nice response 🙏🙏
@einfacherkerl3279
@einfacherkerl3279 6 ай бұрын
i have a question. if i want to have a generic component, let's say a grid. and the generic argument is the data that is passed to the grid which off course is a list of rows with each row having same columns. i want the child component, a grid column to bind to a particular column of the data. how is it possible?
@SakuraDev
@SakuraDev 6 ай бұрын
Yes it is possible. here is an example: github.com/vahid-nejad/medical-evaluator-tooth/blob/main/src/components/elements/DataTable.tsx
@ThugLifeModafocah
@ThugLifeModafocah Жыл бұрын
because of temporal dead zone. Arrows functions are a bad idea when you want to avoid it.
@Pareshbpatel
@Pareshbpatel 7 ай бұрын
The compound-component React Pattern, so clearly explained. Thank you. {2024-06-10}
@mediacreatif
@mediacreatif Жыл бұрын
Thanks but I don't understand why the second method is a better practice, it looks more difficult and complex....
@SakuraDev
@SakuraDev Жыл бұрын
Hi. It move the complexity inside the component. you define the complex code once and use it multiple time.
@liu-river
@liu-river Жыл бұрын
It's basically a reusable component, you can do the same by using the first pattern and just pass in the content as arguments. But then you can't really read the component and it's content until you open up the component file, this shows you exactly what the component contains. It's up to you how you wanna do it, each to their own.
@SakuraDev
@SakuraDev Жыл бұрын
@@liu-river thanks for your nice explanation
@Edwinil
@Edwinil Жыл бұрын
Hi, is there a different between composition component(kzbin.info/www/bejne/rIG1lYxubMSGfpI) and compound component? Can we use context API in both? The main function CompoundCard can share props with anothers children functions? Thanks for the video.
@Edwinil
@Edwinil Жыл бұрын
Btw, your method looks more organic than the other video.
@SakuraDev
@SakuraDev Жыл бұрын
Hi, It's slightly different. in compound pattern the children a CARD are specific to the parent and can't be used outside of the parent
@popuguytheparrot_
@popuguytheparrot_ Жыл бұрын
clowns
@popuguytheparrot_
@popuguytheparrot_ Жыл бұрын
its bad pattern lol tree shaking leave from chat
@galactusclb5733
@galactusclb5733 Жыл бұрын
Reason?
@popuguytheparrot_
@popuguytheparrot_ Жыл бұрын
@@galactusclb5733 bundlers cant optimize unused namespace import from dot
@KarimShalapy
@KarimShalapy 7 ай бұрын
I was just going to comment something similar, now whenever you import the CompoundCard all of its parts are imported with it and it's not shakeable even if you didn't use these parts. It could be enhanced by simply exporting all the parts without making it compound but then this would be a children-first component not a compound component. I am not sure if I am right or wrong, but this feels wrong.
Refactoring a React component - Design Patterns
15:19
Cosden Solutions
Рет қаралды 101 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 494 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Definitive Guide to React Component Design and the key to avoiding tech debt
1:23:30
Kevin Ghadyani - JavaScript
Рет қаралды 20 М.
Александр Дунай (Альфа-Банк) - Улучшаем качество кода React-приложения с помощью Compound Components
18:43
HolyJS — конференция для JavaScript‑разработчиков
Рет қаралды 4,6 М.
Un-Suck Your React Components - Composable & Compound Components
15:47
Stop Doing this as a React Developer
12:27
CoderOne
Рет қаралды 165 М.
How to build a Recursive React Component
21:16
Sam Selikoff
Рет қаралды 54 М.
Compound Components in React (Design Patterns)
18:21
Cosden Solutions
Рет қаралды 50 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН