Currently in my projects I started using Classes
in JS, mainly in cases related to a certain specific element, for example, User, all HTTP
requests or methods related to it I usually isolate in two classes to facilitate reuse. In the end I end up creating Usuario.js
and UsuarioService.js
. The first only with attributes, getters and setters. And the second with the other methods.
But I have seen many using Mixins
for the same purpose. Do you know which way would be more in keeping with Vue's good development practices? Preferably use Mixin, Class or even the two together?
Obs: Before I used mixins too, I started to use more classes because I realized that people who did not know VueJS with classes than with mixins, in addition to understanding much faster what was happening in the code.