diff --git a/public/index.html b/public/index.html index dc93b83..36b12c1 100644 --- a/public/index.html +++ b/public/index.html @@ -10,4 +10,4 @@
- + \ No newline at end of file diff --git a/src/App.js b/src/App.js index 4167247..1f6286f 100644 --- a/src/App.js +++ b/src/App.js @@ -12,6 +12,18 @@ class App extends Component { ] }; + handleChange = event => { + this.setState({ newTodo: event.target.value }); + }; + + handleSubmit = event => { + event.preventDefault() + this.setState({ + todos: [...this.state.todos, this.state.newTodo], + newTodo: "" + }); + }; + render() { return (
@@ -19,9 +31,17 @@ class App extends Component { {this.state.todos.map(todo => (
  • {todo}
  • ))} +
    + + +
    ); } } -export default App; \ No newline at end of file +export default App; diff --git a/src/index.js b/src/index.js index d23aa44..9172f24 100644 --- a/src/index.js +++ b/src/index.js @@ -2,4 +2,4 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App.js' -ReactDOM.render(, document.getElementById('root')); \ No newline at end of file +ReactDOM.render(, document.getElementById('root'));