This is a companion discussion topic for the original entry at https://strapi.io/blog/understanding-the-different-types-categories-of-strapi-hooks
This article says it has been updated for Strapi v4 but it needs checking again. The section about local hooks does not work; hook.js appears to do nothing in v4. I’ve been trying to figure out the right approach and I think you’ve got to make a plugin instead. Unfortunately this article is the top Google result for anything related to Strapi hooks and it’s really hard to know which parts are accurate.