November 2018
Beginner
502 pages
10h 22m
English
Let's move on to creating data now. We are going to allow the user to enter a post title and body and save it:
interface IState { ... editPost: IPost;}
public constructor(props: {}) { super(props); this.state = { ..., editPost: { body: "", title: "", userId: 1 } };}
<div className="App"> <div className="post-edit"> <input type="text" placeholder="Enter title" value={this.state.editPost.title} onChange={this.handleTitleChange} /> <textarea placeholder="Enter body" value={this.state.editPost.body} onChange={this.handleBodyChange} ...Read now
Unlock full access