Join Eve Porcello for an in-depth discussion in this video Adding state to the note component, part of Learn React.js: The Basics (2015).
- Now that we've added some events to our note…let's add "state" so we can properly handle…note editing.…The first thing that we want to do is to add…a new function here called "renderDisplay".…RenderDisplay is going to show…the contents of our note,…and then we're also going to create…another custom method called "renderForm".…RenderForm is going to allow us…to edit our note.…So the first thing we can do is grab…this entire return statement here…from line 15 through 25,…and I can just cut and paste this into…our renderDisplay method.…
Next, I want to create my renderForm method,…so we basically want to create a <div>…that contains a text area and a button.…So we'll add our return statement here,…then we're going to create a <div>…with a className of "note",…just as we did for our renderDisplay.…We then are going to close our <div>…and inside of this we will add a text area.…
We need to add a couple of things to our textarea,…the first of which is a defaultValue…which will be set to this.props.children,…let's also add to this…
- What is React.js?
- Introducing JSX
- Creating a React component
- Handling events
- Using state
- Defining parent/child relationships
- Adding child elements
- Mounting and updating components
- Creating a React.js app
Skill Level Beginner
Up and Running with AngularJS 1with Ray Villalobos1h 20m Intermediate
1. What is React.js?
2. Getting Started
3. React Components
4. Parent/Child Relationships
5. Component Life Cycle
6. Creating an App
Next steps1m 5s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.