You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reusability – Hooks like useScrollSpy, useRecaptcha, useIsMobile, responsive utilities, and useToast are 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-hooks or packages/reusable-hooks in a monorepo).
Add package.json with react and react-native as peer dependencies.
Source files already live in /reusable-hooks/ – move/copy into the new package.
Migration steps
Copy /reusable-hooks/ contents into the new package directory.
Configure build (e.g. tsup or tsc for ESM/CJS output).
Add workspace dependency so this project consumes the package.
Update src/theme/responsive.ts and src/hooks/* re-exports to pull from the package instead of @/reusable-hooks.
Exports
Main entry: index.ts exporting all hooks and types.
Optional subpath exports: @pkg/responsive, @pkg/use-toast, etc.
Dependencies
Peer: react, react-native (or react-native-web for web-only setups).
Description
Motivation
useScrollSpy,useRecaptcha,useIsMobile, responsive utilities, anduseToastare generic and portable (no app-specific dependencies).Possible Implementation
Create package structure
@landonjohnsondev/reusable-hooksorpackages/reusable-hooksin a monorepo).package.jsonwithreactandreact-nativeas peer dependencies./reusable-hooks/– move/copy into the new package.Migration steps
/reusable-hooks/contents into the new package directory.tsuportscfor ESM/CJS output).src/theme/responsive.tsandsrc/hooks/*re-exports to pull from the package instead of@/reusable-hooks.Exports
index.tsexporting all hooks and types.@pkg/responsive,@pkg/use-toast, etc.Dependencies
react,react-native(orreact-native-webfor web-only setups).