Hi,
If you want to reuse a piece of code or an action in a hook. You can write your code in action, then export it like these screenshots:
Upvote if it was useful