30 Days with LAST Stack
Stimulus
  Unlock this challenge
Login Register

Challenge 2 / 2

Your colleague worked hard to create a carousel Stimulus controller that swaps product images. Now it's on production, but you noticed that the controller is being downloaded on every page... but it's only needed on certain pages. Because this controller imports a large 3rd-party package, you'd like to load that package only when it's needed. Your colleague is on vacation (see note) What can you do to only load this code when it's needed?

Note: It's a well-deserved vacation to eat chocolate and go skiing in the Swiss Alps 🎿. Lucky them!

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.