April 2017
Intermediate to advanced
414 pages
8h 14m
English
Let's look at how I created this component:
// Tasks/app/components/TasksList/index.js ... import TasksListCell from '../TasksListCell'; ... export default class TasksList extends Component { ... async _addTask () { const singleTask = { completed: false, text: this.state.text }
Firstly, tasks are now represented as objects within the array. This allows us to add properties to each task, such as its completed state, and leaves room for future additions.
const listOfTasks = [...this.state.listOfTasks, singleTask]; await AsyncStorage.setItem('listOfTasks', JSON.stringify(listOfTasks)); this._updateList(); } ... _renderRowData (rowData, rowID) { return ( <TasksListCell completed={ rowData.completed } ...Read now
Unlock full access