Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
preact - how to get the current component instance

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!