Day 28
Codingphase was in a weather related car wreck and did not post a video. I am still going to post code today... Somedays I wish I could take a break, but this is very important to me and the future of my family.
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
handleAddProject(project){
let projects = this.state.projects;
projects.push(project);
this.setState({projects:projects});
}
handleDeleteProject(id){
let projects = this.state.projects;
let index = projects.findIndex(x => x.id === id);
projects.splice(index, 1);
this.setState({projects:projects});
}
render() {
return (
<div className="App">
<AddProject addProject={this.handleAddProject.bind(this)} />
<Projects projects={this.state.projects} onDelete={this.handleDeleteProject.bind(this)} />
<hr />
<Todos todos={this.state.todos} />
</div>
);
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
handleAddProject(project){
let projects = this.state.projects;
projects.push(project);
this.setState({projects:projects});
}
handleDeleteProject(id){
let projects = this.state.projects;
let index = projects.findIndex(x => x.id === id);
projects.splice(index, 1);
this.setState({projects:projects});
}
render() {
return (
<div className="App">
<AddProject addProject={this.handleAddProject.bind(this)} />
<Projects projects={this.state.projects} onDelete={this.handleDeleteProject.bind(this)} />
<hr />
<Todos todos={this.state.todos} />
</div>
);
Comments
Post a Comment