-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Motivation
- Reusability – Hooks like
useScrollSpy,useRecaptcha,useIsMobile, responsive utilities, anduseToastare generic and portable (no app-specific dependencies). - Maintainability – Single source of truth; package can be versioned and updated independently.
- Reduced duplication – Other projects can depend on the package instead of copy-pasting hooks.
- Testability – Hooks can be unit-tested once and trusted across consumers.
Possible Implementation
-
Create package structure
- Create a new package (e.g.
@landonjohnsondev/reusable-hooksorpackages/reusable-hooksin a monorepo). - Add
package.jsonwithreactandreact-nativeas peer dependencies. - Source files already live in
/reusable-hooks/– move/copy into the new package.
- Create a new package (e.g.
-
Migration steps
- Copy
/reusable-hooks/contents into the new package directory. - Configure build (e.g.
tsuportscfor ESM/CJS output). - Add workspace dependency so this project consumes the package.
- Update
src/theme/responsive.tsandsrc/hooks/*re-exports to pull from the package instead of@/reusable-hooks.
- Copy
-
Exports
- Main entry:
index.tsexporting all hooks and types. - Optional subpath exports:
@pkg/responsive,@pkg/use-toast, etc.
- Main entry:
-
Dependencies
- Peer:
react,react-native(orreact-native-webfor web-only setups). - No Next.js or project-specific imports.
- Peer:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request