mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-30 05:23:53 +03:00
31 lines
594 B
JavaScript
31 lines
594 B
JavaScript
|
import React, { Component } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import TodoTextInput from './TodoTextInput';
|
||
|
|
||
|
class Header extends Component {
|
||
|
handleSave(text) {
|
||
|
if (text.length !== 0) {
|
||
|
this.props.addTodo(text);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<header className="header">
|
||
|
<h1>todos</h1>
|
||
|
<TodoTextInput
|
||
|
newTodo
|
||
|
onSave={this.handleSave.bind(this)}
|
||
|
placeholder="What needs to be done?"
|
||
|
/>
|
||
|
</header>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Header.propTypes = {
|
||
|
addTodo: PropTypes.func.isRequired,
|
||
|
};
|
||
|
|
||
|
export default Header;
|