breaking up into stages

This commit is contained in:
Micah Godbolt
2019-02-21 14:29:33 -08:00
parent 102c14648a
commit 37598e5812
62 changed files with 906 additions and 129 deletions

View File

@@ -6,6 +6,7 @@ demo
add state
pass to header and list
add filter class stuff
controlled components (header) with consolelog
exercise
update footer to include todos

View File

@@ -8,7 +8,7 @@ export class TodoHeader extends React.Component<any, any> {
<header>
<h1>todos</h1>
<div className="addTodo">
<input className="textfield" placeholder="add todo" />
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
@@ -19,4 +19,12 @@ export class TodoHeader extends React.Component<any, any> {
</header>
);
}
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};
_onAdd = () => {
console.log(this.state.labelInput);
this.setState({ labelInput: '' });
};
}