Skip to content

Instantly share code, notes, and snippets.

@dpastoor
Created January 18, 2016 04:12
Show Gist options
  • Select an option

  • Save dpastoor/d0f95848c39bc2df3cde to your computer and use it in GitHub Desktop.

Select an option

Save dpastoor/d0f95848c39bc2df3cde to your computer and use it in GitHub Desktop.
getting ref values in react
const AddTodo = ({
onAddClick
}) => {
let input;
return (
<div>
<input ref={node => {
input = node;
}} />
<button onClick={() => {
onAddClick(input.value);
input.value = '';
}}>
Add Todo
</button>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment