Last active
October 19, 2015 02:49
-
-
Save antonycourtney/83143109969846e84e4f to your computer and use it in GitHub Desktop.
React Header component for oneref-todomvc
This file contains hidden or 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
/** | |
* Header.react.js -- React component for TodoMVC Header UI | |
*/ | |
import React from 'react'; | |
import TodoTextInput from './TodoTextInput.react'; | |
import * as TodoActions from '../todoActions'; | |
export default class Header extends React.Component { | |
render() { | |
return ( | |
<header id="header"> | |
<h1>todos</h1> | |
<TodoTextInput | |
id="new-todo" | |
placeholder="What needs to be done?" | |
onSave={(text) => this._onSave(text)} | |
/> | |
</header> | |
); | |
} | |
_onSave(text) { | |
if (text.trim()){ | |
TodoActions.create(text,this.props.stateRefUpdater); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment