Skip to content

[Hook Extraction] Move Global Reusable Hooks to @ever-teams/hooks in packages/hooks #3794

@NdekoCode

Description

@NdekoCode

The goal of this task is to extract all globally reusable hooks from core/hooks/ and place them in a shared package: packages/hooks → @ever-teams/hooks

This will allow us to:

  • Reuse them in future on other apps like our Ever Teams React Native apps
  • Ensure shared logic is centralized and versioned
  • Improve maintainability and testing

Scope of Hooks to Extract

Target generic, cross-app hooks, typically located under core/hooks/common/ or used widely in multiple features, such as:

  • useModal
  • usePagination
  • useQuery
  • useLocalStorageState
  • useFirstLoad
  • useLanguage
  • useDateRange
  • useDetectOS
  • useHasMounted
  • useScrollListener
  • useCheckAPI
  • useOutsideClick

Any hook that does not rely on specific business entities in the web part (user, task, project, etc.) and can be reused in other apps should be extracted here.

Implementation Plan

  1. Identify candidate hooks inside core/hooks/common/ or core/hooks/*/ that can be reused outside of the web app.
  2. Move the implementation to packages/hooks/src/[domain].
  3. Each hook must be:
    • Written in TypeScript
    • Exported from packages/hooks/src/index.ts
    • Covered with proper inline documentation
  4. Update imports in apps/web to use:
    import { useModal } from '@ever-teams/hooks';
  5. Add usage examples (if applicable) in `/apps/playground

Notes

  • All moved hooks must be free from direct dependencies to @/app, @/core, or Next.js router
  • Add comments and types where needed for external consumption
  • Test the hooks properly (usage tests)

Reviewers

  • @NdekoCode for final review and approval
  • @Thierry for testing and usage validation in apps/web

Metadata

Metadata

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions