From 82a727e50a4bac8b471bc63b018d54cfcbaf0534 Mon Sep 17 00:00:00 2001 From: Qinfeng Li <132120824+ustcandy@users.noreply.github.com> Date: Sun, 26 Oct 2025 18:29:25 +0800 Subject: [PATCH] Integrate React Query and update root rendering Added React Query for data fetching and updated rendering method. --- src/main.tsx | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index 3d4bdea..bd61074 100755 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,23 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App' import './index.css' -import App from './App.tsx' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -createRoot(document.getElementById('root')!).render( - - - , -) \ No newline at end of file +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 15000, + refetchInterval: 15000, + retry: 1, + }, + }, +}) + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + + + , +)