New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@danmatlam/store

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danmatlam/store

This library provides a set of hooks for data fetching using React Query. It is designed to be easily integrated into React applications, allowing for efficient data retrieval and caching mechanisms.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

React Query Shared Hooks Data Fetching Library

This library provides a set of hooks for data fetching using React Query. It is designed to be easily integrated into React applications, allowing for efficient data retrieval and caching mechanisms.

Installation

Before you can use the hooks, you must add this library to your project:

npm install @danmatlam/store

## Setup query client provider

```js
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const queryClient = new QueryClient();

function MyApp({ Component, pageProps }) {
  return (
    <QueryClientProvider client={queryClient}>
      <Component {...pageProps} />
    </QueryClientProvider>
  );
}

export default MyApp;

Use the hooks

import { useGetPokemon } from '@yourusername/pokemon-data-fetching-library';

function PokemonComponent() {
    const { data, isLoading, error } = useGetPokemon({ pokemon: 'charmander' });

    if (isLoading) return <div>Loading...</div>;
    if (error) return <div>An error occurred: {error.message}</div>;

    return (
        <div>
            <h1>{data.name}</h1>
            <img src={data.sprites.front_default} alt={data.name} />
        </div>
    );
}

FAQs

Package last updated on 24 Nov 2023

Did you know?

Socket

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.

Install

Related posts