mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			579 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			579 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import React, { PropTypes, Component } from 'react';
 | 
						|
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={true}
 | 
						|
                         onSave={::this.handleSave}
 | 
						|
                         placeholder='What needs to be done?' />
 | 
						|
      </header>
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |