Skip to content

Instantly share code, notes, and snippets.

@bliaxiong
Created February 11, 2020 03:53
Show Gist options
  • Save bliaxiong/8dbe674275f9db0407303840e7842eb3 to your computer and use it in GitHub Desktop.
Save bliaxiong/8dbe674275f9db0407303840e7842eb3 to your computer and use it in GitHub Desktop.
import React, { Component } from "react";
import PropTypes from "prop-types";
import TaskItem from "./TaskItem";
import { randomStr } from "../utils/util"
class TaskItems extends Component {
static propTypes = {
taskListId: PropTypes.num,
taskItems: PropTypes.array,
userId: PropTypes.string
};
constructor(props) {
super(props);
this.state = {
taskListId: props.taskListId,
taskItems: props.taskItems,
userId: props.userId
};
console.log("props", props)
console.log("task items", this.state.taskItems)
this.addTaskItem = this.addTaskItem.bind(this);
}
addTaskItem(event) {
}
render() {
// let taskItems = this.state.taskItems.map(ti => (
// <TaskItem
// id={ti.id}
// name={ti.name}
// status={ti.status}
// dueDate={ti.dueDate}
// startDate={ti.startDate}
// finishDate={ti.finishDate}
// taskListId={this.state.taskListId}
// key={randomStr()}
// />
// ));
return (
<div className="">
{/* Button to add task item */}
<div className="pull-right">
<button onClick={this.addTaskItem}>Add Task Item</button>
</div>
<div>
{/* {taskItems} */}
</div>
</div>
);
}
}
export default TaskItems;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment