November 2018
Beginner
502 pages
10h 22m
English
Let's move on to updating data now. We are going to allow the user to click an Update button in an existing post to change and save it:
<li key={post.id}> <h3>{post.title}</h3> <p>{post.body}</p> <button onClick={() => this.handleUpdateClick(post)}> Update </button></li>
private handleUpdateClick = (post: IPost) => { this.setState({ editPost: post });};
private handleSaveClick = () => { if (this.state.editPost.id) ...Read now
Unlock full access