Have you folks noticed Michael's t-shirt, it's pretty awesome. Where did you get it from? Because I might need to order one myself. So I had a few years ago my wife got me a Vue shirt for my birthday but you know, it kind of gets old and worn and so I actually designed this shirt myself and got it like custom printed on. Nice, nice! So now you've got some inspiration you can go and custom print your own Vue t-shirt.
We've got a few other questions in here, I'm just going to jump to the ones that are relevant to your talk. We've got one that says smaller components can often be more performance. They don't load any CSS or JS when it's not needed. But when does the complexity of smaller components outweigh the performance benefits and this is kind of related to when not to create a new component. So it's a bit of a long question, but there's some substance in there, finding that right time to switch over.
Yeah, so I don't have as much experience in performance optimization of web apps, so I can't really speak to that aspect of it as much. But I think in general there is this question of how small is too small? Because eventually you don't want to have 30 files open and each file is five lines, because the context switching between each of those things then is the thing that makes it hard. So maybe performance in a mental capacity way. Yeah, definitely. It's kind of like what Evan was saying as well, there is performance and there is how happy are you as a developer actually writing the code. Yeah, developer experience. I think developer experience is something you want to make sure you optimize for as well.
And another one which is kind of a very view related question, for large and complex components written with the composition API, how do you recommend structuring the code inside the script tag? Yeah. So, one thing that I really like is to, like, we can create these composables to, like, we can create these composables, and so it makes it really easy to actually extract logic out of your component. And so you can do this, like, with reusable composables that you might use in multiple different components, but you can also do, like, a one to one thing where maybe you have one component that just is more complex and you can't, there's no easy way to make it smaller. But you could take, you know, take sections of that script and pull it out into maybe you have three different composables. And those composables are only used in that component. But at least it lets you break out that logic in a way that's organized and easy to understand.
And let's do one more question, because I know we're running out of time. How do these patterns, this one's from Edward, how do these patterns translate to a more abstract component library or design system? If you're already using a component library or design system and you also have these other patterns that you want to bring to the table, how would you bring them in and incorporate them? Yeah. I think they're it's a pretty similar approach, I would say. Working on a component library is there's a lot more thought that goes into the API, like Eduardo was talking about of like making it easier to use. And I think that can in some ways affect how you structure your components. But yeah.
Nice. Nice. Thank you. Now I know you have some extra copies of the book, not just for the questions that were asked. So if you did ask a question, your answer got read. And maybe if you also just want to check out the book, I would say definitely go and meet Michael upstairs after this talk as well. Definitely be able to answer any other questions that we weren't able to get to. But Michael, thank you so much.
Comments