How would you create a parameterized Svelte tooltip Action?
It tests your grasp of the Svelte Action lifecycle for reactive parameters. Answer: action takes node and parameter, returns update and destroy, bound as use:tooltip={text}. Using component events instead of the Action API, or omitting update, is a red flag.
It tests whether you understand Svelte Actions as element-level lifecycle hooks and how to handle reactive parameters without node recreation. A great answer defines an Action<HTMLElement, string> receiving node and parameter, adds mouseenter and mouseleave handlers to toggle a tooltip, returns update to swap text on changes, and destroy to remove listeners and the tooltip. Proposing a store or component events instead of use:, or claiming the action rebuilds on every change, is a red flag.
Read the original → v4.svelte.dev
- #svelte
- #actions
- #typescript
- #dom
- #interview
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.