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