Let's say that we have an App was already mounted, in main.js:
createApp(App).mount('#app');
And I'd like to write a function, which should be called like this:
createModal({
render: () => <SomeComponent />,
});
Normally when we implement functions like above, we just call the createApp(h(render)) function, and then mount its instance in anywhere we want.
But the problem is that when we did, the modal instance won't inherit anything from the root App.
So if we have something like provide('root', 'here') was processed in the root App, and then we call inject('root') in the other App, we won't get the string result here.
Instead, the result will be undefined, Because these two Apps are not sharing the same context.
What should I do to make things right?