Learn the power of shouldComponentUpdate.
- [Instructor] In this video,…we're going to talk about shouldComponentUpdate,…which is perhaps one of our most useful methods…when it comes to optimizing our component.…One important thing you need to know…about shouldComponentUpdate is that it must always return…a value and give it as a question.…Should my component update?…And you need to return a true or a false.…By default, shouldComponentUpdate is going to return a true.…It's going to say oh yeah,…when I get changes to props or state,…I'm going to update the component.…So, we need to remember once we start modifying…shouldComponentUpdate, there might be ways…where we are saying, okay, don't update,…but then later on, if you change your application…or you change that component, you might find later…that you get bugs, because you told shouldComponentUpdate…to not update in certain scenarios,…but actually now, your desired behavior has changed,…so you won't see your updates take effect in that component.…
So you need to be careful with that,…and make sure that you are keeping track…
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
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.