Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import PropTypes from "prop-types";
- import {connect} from "react-redux";
- import { ADD_TODO } from "./actions";
- class App extends React.Component {
- constructor(props){
- super(props);
- this.state = {
- value: ''
- }
- }
- const todoInput = e => {
- this.setState({value: e.target.value})
- };
- const clear = () => {
- this.setState({value: ''});
- };
- render() {
- return (
- <div className="App">
- <input type="text" onChange={this.todoInput} value={this.state.value} />
- <button onClick={this.clear}>Add Todo</button>
- </div>
- );
- }
- }
- export default connect(null, {ADD_TODO})(App);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement