
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-hookbox/data-query
Advanced tools
> Powerful asynchronous state management for React — built on top of @tanstack/react-query, for data fetching, caching, and mutating.
Powerful asynchronous state management for React — built on top of @tanstack/react-query, for data fetching, caching, and mutating.
createDataQuery for creating query definitionsuseDataQuery for fetching and caching datacreateDataMutation for creating mutation definitionsuseDataMutation for creating/updating/deleting datanpm install @react-hookbox/data-query @tanstack/react-query
yarn add @react-hookbox/data-query @tanstack/react-query
pnpm add @react-hookbox/data-query @tanstack/react-query
This package requires @tanstack/react-query as a peer dependency. Make sure to wrap your app with QueryClientProvider:
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
const queryClient = new QueryClient();
function App() {
return <QueryClientProvider client={queryClient}>{/* Your app */}</QueryClientProvider>;
}
import { createDataQuery, useDataQuery } from '@react-hookbox/data-query';
// Define the query
const userQuery = createDataQuery({
queryFn: async (variables: { id: string }) => {
const response = await fetch(`/api/users/${variables.id}`);
return response.json();
},
queryKey: (variables) => ['user', variables.id],
});
// Use in a component
function UserProfile({ id }: { id: string }) {
const [response] = useDataQuery(userQuery, { id });
if (response.isLoading) return <div>Loading...</div>;
if (response.isError) return <div>Error: {response.error.message}</div>;
return <div>{response.data?.name}</div>;
}
import { createDataMutation, useDataMutation } from '@react-hookbox/data-query';
// Define the mutation
const createUserMutation = createDataMutation({
mutationFn: async (variables: { name: string; email: string }) => {
const response = await fetch('/api/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(variables),
});
return response.json();
},
});
// Use in a component
function CreateUserForm() {
const [mutate, { isPending, isError, error, isSuccess }] = useDataMutation(createUserMutation, {
onSuccess: (data) => {
console.log('User created:', data);
},
onError: (error) => {
console.error('Failed to create user:', error);
},
});
const handleSubmit = () => {
mutate({ name: 'John Doe', email: 'john@example.com' });
};
return (
<div>
<button onClick={handleSubmit} disabled={isPending}>
{isPending ? 'Creating...' : 'Create User'}
</button>
{isSuccess && <p>User created successfully!</p>}
{isError && <p>Error: {error?.message}</p>}
</div>
);
}
pnpm build
pnpm clean
pnpm lint
pnpm check-types
MIT
FAQs
> Powerful asynchronous state management for React — built on top of @tanstack/react-query, for data fetching, caching, and mutating.
We found that @react-hookbox/data-query 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.