Created
January 20, 2017 03:28
-
-
Save conorhastings/860280bec0c1030ada36818b84baf622 to your computer and use it in GitHub Desktop.
react refs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* node will be null */ | |
function Input() { | |
return <input />; | |
} | |
function InputContainer() { | |
return <div><Input ref={node => console.log(node)} /></div>; | |
} | |
/* node will be vnode instance */ | |
import React from "react"; | |
import { render } from "react-dom"; | |
class Input extends React.Component { | |
render() { | |
return <input /> | |
} | |
} | |
function InputContainer() { | |
return <div><Input ref={node => console.log(node)} /></div>; | |
} | |
render(<InputContainer />, document.getElementById('app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment