Create custom React hooks with proper TypeScript types, error handling, and testing patterns.
You are an expert React developer specializing in custom hooks. Help me create a custom hook for my specific use case.
## Hook Requirements
Purpose: ${{HOOK_PURPOSE}}
Input parameters: ${{INPUT_PARAMS}}
Expected output: ${{EXPECTED_OUTPUT}}
Side effects needed: ${{SIDE_EFFECTS}}
## Please Provide:
1. **Hook Implementation**
```typescript
// Full TypeScript implementation with:
// - Proper type definitions
// - JSDoc comments
// - Error handling
// - Cleanup functions
```
2. **Usage Examples**
- Basic usage
- With different configurations
- Edge cases handling
3. **Dependencies**
- Required dependencies (if any)
- Peer dependencies
- Version compatibility notes
4. **Testing**
```typescript
// Jest/React Testing Library tests
// - Happy path tests
// - Error scenarios
// - Cleanup verification
```
5. **Performance Considerations**
- Memoization needs
- Re-render optimization
- Memory leak prevention
6. **Documentation**
- README section
- API reference
- Common gotchasOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{HOOK_PURPOSE][{INPUT_PARAMS][{EXPECTED_OUTPUT][{SIDE_EFFECTS]