Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import {connect} from "react-redux";
  4. import { ADD_TODO } from "./actions";
  5.  
  6. class App extends React.Component {
  7. constructor(props){
  8. super(props);
  9. this.state = {
  10. value: ''
  11. }
  12. }
  13. const todoInput = e => {
  14. this.setState({value: e.target.value})
  15. };
  16. const clear = () => {
  17. this.setState({value: ''});
  18. };
  19. render() {
  20. return (
  21. <div className="App">
  22. <input type="text" onChange={this.todoInput} value={this.state.value} />
  23. <button onClick={this.clear}>Add Todo</button>
  24. </div>
  25. );
  26. }
  27. }
  28.  
  29. export default connect(null, {ADD_TODO})(App);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement