dfilatov / vidom

Library to build UI based on virtual DOM
MIT License
415 stars 16 forks source link

Get DOM ref inside component #151

Closed mrjjwright closed 8 years ago

mrjjwright commented 8 years ago

I am sorry, but how do you get a dom ref inside a component? I couldn't figure this out in the docs.

Thanks and awesome lib!

dfilatov commented 8 years ago

Hi, John. To get a dom ref inside a component use this.getDomRef(refName) https://github.com/dfilatov/vidom/wiki/Component-methods#getdomref

mrjjwright commented 8 years ago

But how to set a dom ref to the root node of the component?

On Tue, Oct 13, 2015 at 3:30 PM, Filatov Dmitry notifications@github.com wrote:

Closed #151 https://github.com/dfilatov/vidom/issues/151.

— Reply to this email directly or view it on GitHub https://github.com/dfilatov/vidom/issues/151#event-434554191.

dfilatov commented 8 years ago

Just as well for other nodes.

Plain js:

onRender() {
    return this.setDomRef('bla', node('div'));
}

JSX:

onRender() {
    return <div ref="bla"></div>
}
mrjjwright commented 8 years ago

Thanks!!

Sent from my iPhone

On Oct 14, 2015, at 2:06 AM, Filatov Dmitry notifications@github.com wrote:

Just as well for other nodes.

Plain js:

onRender() { return this.setDomRef('bla', node('div')); } JSX:

onRender() { return

} — Reply to this email directly or view it on GitHub.