
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
graphql-hooks
Advanced tools
🎣 Minimal hooks-first graphql client.
async
/ await
)npm install graphql-hooks
or
yarn add graphql-hooks
First you'll need to create a client and wrap your app with the provider:
import { createClient, ClientContext } from 'graphql-hooks';
const client = createClient({
endpoint: '/graphql'
});
function App() {
return (
<ClientContext.Provider value={client}>
{/* children */}
</ClientContext.Provider>
);
}
Now in your child components you can make use of useQuery
import { useQuery } from 'graphql-hooks';
const HOMEPAGE_QUERY = `query HomePage($limit: Int) {
users(limit: $limit) {
id
name
}
}`;
function MyComponent() {
const { loading, error, data } = useQuery(HOMEPAGE_QUERY, {
variables: {
limit: 10
}
});
if (loading) return 'Loading...';
if (error) return 'Something Bad Happened';
return (
<ul>
{data.users.map(({ id, name }) => (
<li key={id}>{name}</li>
))}
</ul>
);
}
createClient
ClientContext
useClient
useQuery
useManualQuery
useMutation
FAQs
Graphql Hooks
The npm package graphql-hooks receives a total of 17,127 weekly downloads. As such, graphql-hooks popularity was classified as popular.
We found that graphql-hooks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.