Try Install Learn Blog API Packages GitHub
Pages

Lifecycle Functions

Components have the following lifecycle functions:

  • componentDidMount - this is called when the component is mounted
  • componentDidUpdate - this is called when the component is updated
  • componentWillUnmount - this is called when the component is about to be unmounted
component Test {
  fun componentDidMount : Promise(Void) {
    Debug.log("MOUNTED")
  }

  fun componentDidUpdate : Promise(Void) {
    Debug.log("UPDATED")
  }

  fun componentWillUnmount : Promise(Void) {
    Debug.log("WILL UNMOUNT")
  }

  fun render : Html {
    <div>
      "Hello!"
    </div>
  }
}