React ref equivalent in hyperapp v2?
aminroosta opened this issue · 4 comments
In v1
there where undocumented lifecycle methods (oncreate
, onupdate
, and onremove
) that could be used to get a reference to the dom node created.
That has been removed in v2
.
How do I get a reference to a DOM node?
The answer really depends on what you want to use that DOM node for.
The easy way is with document.getElementById()
inside a custom effect or outside your application's pure layer.
What are you trying to do?
There is a library called split.js , I'm writing a wrapper for.
var split = Split(<HTMLElement|selector[]> elements, <options> options?)
Basically i need to pass $parent.children
the first time my component is created and clean it up once it's removed.
closing, since it's been discuss before in #717
@aminroosta In case you're unclear on the details, have a look at # 10 of my code-along video series where I implement a custom effect for finding dom elements to call the .focus()
method on them.