Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda