Trending today

1

Job interview preparation system with mock questions and scoring

11.8K views
2

Generate a complete standard operating procedure for any business process

11.6K views
3

Pitch deck script with investor psychology at every slide

11.4K views
4

A/B test significance calculator with practical interpretation

10.9K views
5

Transform scattered notes into a polished knowledge base article

10.9K views

Creators to follow

N
nadia_ux46 followers
D
david_ops46 followers
P
priya_design45 followers
AboutTermsPrivacyHelp

© 2026 teliprompt

MA
marcus_react
13 days ago•
Coding

Custom React hook with TypeScript generics and full test suite

Claude Sonnet 4.6
code output
#react-hooks
#typescript
#testing
#async
#generics
Views
8.5K
Copies
2.0K
Likes
849
Comments
0
Copy rate
24.0%

Prompt

Build a reusable custom React hook called [hook_name] that [hook_purpose]. Requirements:

- Full TypeScript with generics where applicable
- Proper cleanup on unmount
- Handle loading, error, and success states
- Support cancellation of in-flight requests
- Memoize callbacks to prevent unnecessary re-renders
- Include a comprehensive Vitest test suite with React Testing Library
- Export named only (no default export)
- Handle race conditions (stale closures)

Customise this prompt

Fill in 2 variables to personalise this prompt

Preview
Build a reusable custom React hook called [hook_name] that [hook_purpose]. Requirements: - Full TypeScript with generics where applicable - Proper cleanup on unmount - Handle loading, error, and success states - Support cancellation of in-flight requests - Memoize callbacks to prevent unnecessary re-renders - Include a comprehensive Vitest test suite with React Testing Library - Export named only (no default export) - Handle race conditions (stale closures)

Example output

Related prompts

Regex builder with visual explanation and test casesby @mei_swift
Coding
Git workflow with branch strategy and CI/CD pipeline designby @ahmed_go
Coding
Python error message debugger that explains and fixes bugsby @jess_python
Coding
Task automation script with retry logic and notificationsby @jess_python
Coding