# Multiple hooks in Phoenix?

**URL:** <https://forum.elixirforum.com/t/multiple-hooks-in-phoenix/68871>\
**Category:** Questions\
**Tags:** phoenix, liveview, hooks\
**Created:** [January 21, 2025, 5:44am UTC](https://forum.elixirforum.com/t/multiple-hooks-in-phoenix/68871 "2025-01-21T05:44:57Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Liam\_or](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/l/8e7dd6/32.png) [@Liam\_or](https://forum.elixirforum.com/u/Liam_or)\
**Post date:** [January 21, 2025, 3:08pm UTC](https://forum.elixirforum.com/t/multiple-hooks-in-phoenix/68871/7 "2025-01-21T15:08:58Z")

</div>

Well, I’m trying to think more generally to understand the best approach to using hooks. I’d like to work on JS-heavy features, such as implementing drag-and-drop or drawing with SVGs. However, I want to ensure the code is modular and reusable, similar to how I would structure it with vanilla JavaScript or a framework like Svelte.

For instance, in a drag-and-drop feature, I might have functions that process pointer events, retrieve the client X/Y coordinates, and transform that data into a specific unit. In Svelte, I would make these reusable functions since I might use them frequently across my codebase.

If I combine everything into a single component-style hook, I risk ending up with redundant or repeated code. So I’m looking for general advice on how I can best structure hooks to maintain modularity and reusability while avoiding code repetition

---

_[View the full topic](https://forum.elixirforum.com/t/multiple-hooks-in-phoenix/68871)._
