Understanding the OWL component life cycle
OWL components have several methods that help developers to create powerful and interactive components. In this recipe, we will see important methods of the components and the life cycle when these methods are called. In this recipe, we will add several methods to the component, and we will log the message in the console to understand the life cycle of the component.
Getting ready
For this recipe, we will continue using the my_library
module from the previous recipe.
How to do it...
To add life cycle methods to the component, you need to carry out the following steps:
- As we already have a constructor in the component, let's add a message to the console like this:
constructor() { Â Â Â Â console.log('CALLED:> constructor'); ...
- Add the
willStart
method to the component:async willStart() { Â Â Â Â console.log('CALLED:> willStart'); }
- Add the
mounted
method...