Review the new syntax for setState.
- [Instructor] In this chapter,…we're going to be looking at some of the lifecycle methods…that occur when our component gets updated,…and one of the chief ways that you might trigger an update…is by using setState.…So we're going to add setState to our logger,…and I'm also going to go over some of the expanded syntax…that we can now use in setState.…So I'm going to scroll up to the top here in App.js,…actually, I'll go to loggify.js,…and I just want to write, here on line five,…some of the new setState syntax…so that you can get a handle of what's going on.…
I'm going to make some comments,…because we don't actually want this code to run,…but I think it might be useful for you to know.…So when we're inside React, as I'm sure you're aware,…you can go this.setState,…and oftentimes, you'll see people do someKey,…and then they'll put in newValue.…So this is sort of the concise syntax for this.setState.…You might see it even shorter.…You might see people say this.setState…and they might go like this, right?…Because we can just pass in the key value pair…
Carl Peaslee helps you build a number of small reusable components that will be useful in future projects. Along the way, he discusses the syntax and uses of lifecycle methods, how state affects React lifecycles and your apps, and how to set static display name, default props, and initial state. Plus, learn how to gather performance data and improve performance by minimizing component updates.
- Overview of React lifecycles
- Initial state
- Default props
- Mounting: componentWillMount, componentDidMount, and render
- Updating: shouldComponentUpdate, componentWillUpdate, and componentDidUpdate
- Controlling component updates
- Using react-addons-perf to get performance data
Skill Level Intermediate
React.js: Building an Interfacewith Ray Villalobos1h 21m Intermediate
1. Overview of Lifecycles
2. Defaults, Initialization, and Construction
5. Optimizing Components
- 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.