Is there a way to access the instance / get a reference of the function Component that it is currently rendered/active in preact, an thus its current props, hooks, internal state, effects etc.?
I am looking for something like React's __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner (but consumable also in production) or Svelte's runtime internal get_current_component().
To give you a bit of context, the reason why I need it is because I am building a library that provides a function that should be able to access the props of the Component currently consuming this function, in production and during runtime.
I was looking at preact's source code, and I found that in preact/hooks/src/index.js there is a currentComponent global variable, but I couldn't understand how this is obteined. I have tried to play with options, or with render, imported from preact, but still couldn't figure out how to access the current component.
Is there any way to achieve it in preact, or is there any 'hack' to achieve something similar?
Thx in advance