What is the best method to send data from a child component to the parent in Stencil.js?
I tried using a callback method, but it looks like it is imperative to use Events to accomplish this. It seems to me that we write a lot more to have 2 way data transfer than I would think it is necessary. I have to mention that I am building a web components library that could be used later in either React or Angular projects.
The recommended ways to communicate with a parent component is indeed through a custom event. But there are some other options as well, which might make more sense in some situations:
Direct upward communication
You can manually select a parent component and set attributes or properties on it:
Stencil Store
A state library by the Stencil team to communicate with a central store, which other components can watch for changes. Note that I never tried it with Angular or React, but I think it should still work.