javascript - React - get React component from a child DOM element? -
i'd able figure out react component associated dom element.
for example, have div, , i'm rendering entire application using react. div has rendered react component - one?
i know react supplies method "getdomnode" dom node associated react component, i'd opposite.
is possible?
no.
a central concept in react don't have control in dom. instead, control factory function. what's in dom current render of control.
if need this, can keep object global variable, keys string representations of names of factory functions, , values factory functions, on renderable div, keep attribute containing name of factory function.
but chances question of xy problem (needing x, seeing way y, asking how y.) if you'd explain goal there's better way better fits react's top-down conceptual model.
generally speaking, asking access control render asking access svg cached png render. it's possible, it's red flag else conceptually wrong.
Comments
Post a Comment