DEV Community

Cover image for Order of Stimulus lifecycle callbacks
haroldus-
haroldus-

Posted on

Order of Stimulus lifecycle callbacks

The order of callbacks in a stimulus controller can be easy to trip up on, especially when integrating some other JS library which you initialize once everything is connected. The order is:

  1. target connected
  2. connect(){...}
  3. outlet connected

So if you are using an outlet with your other library, you'll likely want to initialize it within the outlet connected callback.

Top comments (0)