myitcv / x

Mono-repo for all myitcv.io/... Go code
MIT License
103 stars 20 forks source link

react: using ref #59

Closed pjebs closed 6 years ago

pjebs commented 6 years ago

I'm trying to use an external library.

How do I get an object by its Ref in ComponentDidMount()

How do I set a component's ref? It's not safe to use id: var el = document.GetElementByID("items")

Ref: https://www.javascriptstuff.com/use-refs-not-ids/ https://reactjs.org/docs/refs-and-the-dom.html

myitcv commented 6 years ago

@pjebs my apologies, I'm hopelessly behind on issues generally.

Are you, by any chance, at GopherCon? If so, blitzing through a number of these things in person might be the way forward.

pjebs commented 6 years ago

Not at gophercon

myitcv commented 6 years ago

In which case I'll try to come round to your issues as soon as I can. Thanks for raising them in the first place and for your patience in the meantime.

pjebs commented 6 years ago

Would you be able to put an example on how to use Ref when you have time. That would be greatly appreciated. I don't know how to deal with Ref being an interface.

myitcv commented 6 years ago

Is https://github.com/myitcv/x/blob/master/react/examples/markdowneditor/markdown_editor.go what you are after?

pjebs commented 6 years ago

Yes. Thank you.