Skip to content

Instantly share code, notes, and snippets.

Access method inside React component:
OLD (reliable but not future proof)
const ourComponent = ReactDOM.render(<OurComponent />, document.getElementById("app"));
ourComponent.someMethod() // would call the method
NEW
ReactDOM.render(<Page ref={(ourComponent) => {window.ourComponent = ourComponent}} />, document.getElementById("app"));
window.ourComponent.someMethod()

Keybase proof

I hereby claim:

  • I am avianto on github.
  • I am avianto (https://keybase.io/avianto) on keybase.
  • I have a public key whose fingerprint is E971 37F9 B70F F58F BB62 8029 B3CD 467E F558 BCA0

To claim this, I am signing this object:

@avianto
avianto / gist:3145470
Created July 19, 2012 17:24
Checking gist.io

Experimenting with gist.io

My Markdown skill is rusty...

  • item 1
  • item 2
  • item 3