Consider simplifying a practical scenario...
Imagine having a web application with two columns, each utilizing the same component. The functionality is based on data storage and functions that are stored in a separate composition api js file, which is then imported into the component via provide/inject. It works seamlessly.
However, is there a way to write the composition api js file once, and then generate multiple instances when it's imported to the Vue app? This would allow for individual instances to be assigned to each component without sharing the same data object. I understand that if you import the same file using different names...
import instanceone from "path";
import instancetwo from "path";
...they end up sharing the same objects because they are essentially importing the same file under different names, not creating distinct instances of the file.
Is there a method to achieve this desired outcome? I'm open to any approach that can lead to the same result (without requiring duplicate files for independent usage). One idea was to create a single file that exports objects and functions, followed by two separate files that import specific components of the initial file, and finally letting Vue import these two files - but unfortunately, it did not work as expected.
While there are numerous other ways to tackle this issue, I am intrigued by exploring this particular possibility first, preferably without relying on Vuex.
Thank you!