Installation
Learn how to set up react-hooks-ts in your project.
Installation
Getting started with react-hooks-ts is quick and easy.
Standard Installation
Install the package using your preferred package manager:
npm install react-hooks-ts
# or
yarn add react-hooks-ts
# or
pnpm add react-hooks-tsBasic Usage
Import the hooks you need directly from the package:
import { useCounter } from 'react-hooks-ts'
function App() {
const { count, increment } = useCounter(0)
return (
<button onClick={increment}>
Count is {count}
</button>
)
}Requirements
- React: 18.0.0 or higher
- TypeScript: 4.5.0 or higher (optional, but recommended)