diff --git a/.eslintrc.yml b/.eslintrc.yml index f94c6a3..0587cff 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,4 +1,5 @@ extends: - 'next/core-web-vitals' - - prettier - 'plugin:storybook/recommended' + - 'plugin:@tanstack/eslint-plugin-query/recommended' + - prettier diff --git a/app/layout.tsx b/app/layout.tsx index 8c63ba1..8bc3f36 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,8 @@ import './globals.css'; import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; +import Providers from './providers'; + const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { @@ -16,7 +18,9 @@ export default function RootLayout({ }) { return ( - {children} + + {children} + ); } diff --git a/app/providers.tsx b/app/providers.tsx new file mode 100644 index 0000000..b76eb34 --- /dev/null +++ b/app/providers.tsx @@ -0,0 +1,13 @@ +'use client'; +import { useState } from 'react'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; + +type ProvidersProps = React.PropsWithChildren<{}>; + +export default function Providers({ children }: ProvidersProps) { + const [queryClient] = useState(() => new QueryClient()); + + return ( + {children} + ); +} diff --git a/bun.lockb b/bun.lockb index 5cff3b2..48afc2f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 930bb68..dd60c9f 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build-storybook": "storybook build" }, "dependencies": { + "@tanstack/react-query": "4.35.3", "@types/react": "18.2.21", "@types/react-dom": "18.2.7", "autoprefixer": "10.4.15", @@ -30,6 +31,7 @@ "@storybook/nextjs": "^7.4.1", "@storybook/react": "^7.4.1", "@storybook/testing-library": "^0.2.0", + "@tanstack/eslint-plugin-query": "4.34.1", "@types/node": "20.6.0", "@vanilla-extract/css": "1.13.0", "@vanilla-extract/next-plugin": "2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cbf6fca..9508d08 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@tanstack/react-query': + specifier: 4.35.3 + version: 4.35.3(react-dom@18.2.0)(react@18.2.0) '@types/react': specifier: 18.2.21 version: 18.2.21 @@ -58,6 +61,9 @@ devDependencies: '@storybook/testing-library': specifier: ^0.2.0 version: 0.2.0 + '@tanstack/eslint-plugin-query': + specifier: 4.34.1 + version: 4.34.1(eslint@8.49.0) '@types/node': specifier: 20.6.0 version: 20.6.0 @@ -4149,6 +4155,36 @@ packages: resolution: {integrity: sha512-z/G02d+59gyyUb7KYhKi9jOhicek6QD2oMaotUyG+lUkybpXoV49dY9bj7Ah5Q+y7knK2jU67UTX9FyfGzaxQg==} dev: true + /@tanstack/eslint-plugin-query@4.34.1(eslint@8.49.0): + resolution: {integrity: sha512-RflOwyXamuHhuMX5RL6wtKiVw9Hi5Hhiv9gW2/ICVc4omflB+GflrxwvQ+EWRKrSRv3C0YcR0UzRxuiZ4mLq7Q==} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + eslint: 8.49.0 + dev: true + + /@tanstack/query-core@4.35.3: + resolution: {integrity: sha512-PS+WEjd9wzKTyNjjQymvcOe1yg8f3wYc6mD+vb6CKyZAKvu4sIJwryfqfBULITKCla7P9C4l5e9RXePHvZOZeQ==} + dev: false + + /@tanstack/react-query@4.35.3(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-UgTPioip/rGG3EQilXfA2j4BJkhEQsR+KAbF+KIuvQ7j4MkgnTCJF01SfRpIRNtQTlEfz/+IL7+jP8WA8bFbsw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + '@tanstack/query-core': 4.35.3 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + use-sync-external-store: 1.2.0(react@18.2.0) + dev: false + /@testing-library/dom@9.3.1: resolution: {integrity: sha512-0DGPd9AR3+iDTjGoMpxIkAsUihHZ3Ai6CneU6bRRrffXMgzCdlNk43jTrD2/5LT6CBb3MWTP8v510JzYtahD2w==} engines: {node: '>=14'} @@ -11053,6 +11089,14 @@ packages: tslib: 2.6.2 dev: true + /use-sync-external-store@1.2.0(react@18.2.0): + resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + dependencies: + react: 18.2.0 + dev: false + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}