
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-query-hook-builder
Advanced tools
A simple extension to help you create hooks that can be used inside your codebase
A powerful tool to streamline your React Query development workflow. It automates the generation of type-safe hooks, API functions, query keys, and TypeScript types directly from OpenAPI specifications or manual inputs.
Available as both a VS Code Extension and an npm package for programmatic use.
Install from the VS Code Marketplace
npm install react-query-hook-builder
# or
yarn add react-query-hook-builder
GET requests to useQuery.POST, PUT, DELETE to useMutation.totalRecords) and generates useInfiniteQuery with mostly complete getNextPageParam logic.UserData vs generic Response).The extension generates four distinct parts for each hook, which can be placed in separate files or combined as needed:
axios-based async function to make the network request.useUser, useCreateUser, etc.) wrapping the React Query logic.types.ts or a new hook to useHooks.ts).Cmd+Shift+P or Ctrl+Shift+P).TodoList.GET, POST, etc./api/todos.import { generateFiles, parseOpenApiSpec, formatCode } from 'react-query-hook-builder';
// Example 1: Generate from manual specs
const result = await generateFiles({
featureName: 'getUserList',
methodType: 'GET',
apiUrl: '/api/users',
exampleResponse: JSON.stringify({ users: [], total: 0 }),
params: '',
hookType: 'useQuery'
});
console.log(result.model); // TypeScript interfaces
console.log(result.api); // API function
console.log(result.queryKey); // Query key factory
console.log(result.hook); // React Query hook
// Example 2: Generate from OpenAPI spec
const openApiSpec = await parseOpenApiSpec('https://api.example.com/openapi.json');
// Process spec and generate hooks for specific operations
// Example 3: Format generated code
const formatted = await formatCode(result.hook, '/path/to/workspace');
generateFiles(props: GenerateFilesProps): Promise<GenerateFileResponse>Generates all parts (model, api, queryKey, hook) for a single endpoint.
Parameters:
featureName: string - Name of the feature (e.g., 'getUserList')methodType: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'apiUrl: string - API endpoint URLexampleResponse: string - JSON string of example responseparams: string - JSON string of params/payloadhookType: 'useQuery' | 'useMutation' | 'useInfiniteQuery'responseSchema?: string - Optional response schemaparamsSchema?: string - Optional params schemaReturns: Object with model, api, queryKey, and hook strings
parseOpenApiSpec(urlOrContent: string): Promise<OpenAPI.Document>Parses an OpenAPI specification from URL or JSON string.
formatCode(code: string, workspacePath?: string): Promise<string>Formats TypeScript code using Prettier.
^1.90.0react-query (TanStack Query) and axios. generated code assumes standard axios and react-query imports.This extension currently does not contribute any global settings. It relies on interaction during generation to determine file paths.
{ data: T, success: boolean }) for some heuristic optimizations, but generally supports standard OpenAPI schemas.import { useQuery } from '@tanstack/react-query') to your files manually if they are not already present.Enjoy faster React Query development!
FAQs
A simple extension to help you create hooks that can be used inside your codebase
We found that react-query-hook-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.