redux-devtools/packages/redux-slider-monitor/examples/todomvc/components/Header.js
Jhen-Jie Hong 476e37a875 Add redux-slider-monitor (#434)
* Add redux-slider-monitor

* Fix example configuration of redux-slider-monitor

* Fix lint errors

* CI: Run build:all before lint
2018-12-22 16:20:04 +02:00

29 lines
585 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>
);
}
}