DEV Community

Discussion on: Are you committing these mistakes as a Vue developer?

Collapse
 
napoleon039 profile image
Nihar Raote • Edited

Thanks for reading.

Honestly, I haven't used mixins a lot. About using mixins as a way to have dynamically generated component behavior, I have a few examples but can't find a way to implement them.

Chris mentioned in the podcast that mixins have very specific use cases so maybe that's why it's hard to come up with a situation that justifies making use of mixins. I think he must have come across such a use case or something similar to it. I'll try asking him and get back to you.

Collapse
 
gustojs profile image
Darek Gusto

Thanks. I'm asking because it was explicitly stated in your article that it is possible, and "how to achieve that" was the exact question I was asked just a few days ago by another developer. I thought you actually managed to make it work somehow. I'll try asking Chris too and if I get an answer, I'll paste it here. Thanks a lot. :)

Thread Thread
 
napoleon039 profile image
Nihar Raote • Edited

I asked Chris over the weekend. The example he gave was from a situation he came across. I think he even mentioned it in the podcast but I think I forgot about it πŸ˜› .

The situation is that you have some input components that you're using for multiple currency handling. So depending on the currency option selected, a function would dynamically generate a mixin.

I'll try my best to implement it. Once he gives the green signal that the pattern has been properly implemented, I'll post it here.