Working on a small VueJs SPA with my first experience with VueJs 3. Previously, you could easily add helpers and classes to the Vue instance using prototype. However, VueJs 3 has eliminated this capability and introduced two new options:
- provide / inject
- config.globalProperties
Personally, I find option 2 more appealing as it is straightforward to implement. Option 1, on the other hand, is a bit confusing to me. Why do you have to explicitly add the inject in the child component instead of it happening automatically?
Are there specific use cases for using options 1 and 2? I'm curious because adding helper classes under config seems odd to me. The naming is just strange.