Recording not yet published

Talk 30:00

Hooked on Widgets

Building reusable, stateful widgets in Phoenix LiveView has been challenging. LiveComponents can’t access the process mailbox for PubSub integration, while embedded LiveViews create performance overhead and complex communication patterns. This talk presents a battle-tested alternative: combining function components with LiveView hooks to create truly independent widgets.

You’ll learn how to leverage attach_hook/4 to build widgets that manage their own state, handle events, subscribe to PubSub, and seamlessly integrate into any LiveView — without coupling to parent implementations. Through a real-world notification widget example, we’ll demonstrate how this pattern delivers the best of both worlds: LiveComponent-like behavior with direct mailbox access.