react-hooks-ts
v1.3.0
Published
A collection of 50+ modern, server-safe React hooks with TypeScript.
Maintainers
Readme
react-hooks-ts
A professional collection of 50+ modern, server-safe React hooks written in TypeScript.
🚀 Features
- 50+ Production-ready hooks: From state management to sensor integration.
- 100% TypeScript: Built with type safety as a first-class citizen.
- Server-Safe: Works seamlessly with Next.js (SSR/ISR) and React 18/19.
- Tree-shakeable: Only bundle what you use.
- Zero Dependencies: Lightweight and fast.
📦 Installation
npm install react-hooks-ts
# or
yarn add react-hooks-ts
# or
pnpm add react-hooks-ts💻 Usage
import { useBoolean, useCounter, useIntersectionObserver } from 'react-hooks-ts'
function MyComponent() {
const { value, toggle } = useBoolean(false)
const { count, increment } = useCounter(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={increment}>Increment</button>
<button onClick={toggle}>{value ? 'ON' : 'OFF'}</button>
</div>
)
}🛠️ Hook Categories
- State:
useLocalStorage,useSessionStorage,useHistoryState, etc. - Sensors:
useBattery,useGeolocation,useOrientation, etc. - Utilities:
useDebounce,useInterval,useTimeout, etc. - UI:
useHover,useClickOutside,useWindowSize, etc.
📄 Documentation
For full API documentation and interactive demos, visit react-hooks-ts.com.
👤 Author
Walid CHAYBI
📝 License
MIT © Walid CHAYBI
