In the context of this lesson, are these lifecycle methods optional? And, do they have any default behavior?
Yes, every method other than the
render method is optional.
By default, most of these lifecycle methods will not have any default code or behavior. It will be up to you to implement and override the methods as needed. In a way, you can think of these methods are a template of steps that will take place at specific points throughout the component’s lifecycle, and can be implemented how you want.
A few methods do have default behavior, such as
shouldComponentUpdate(), where the default behavior is to re-render on every state change and defaults to
true, but the majority of the methods do not.