Skip to content

Commit

Permalink
fix: use the new React recommended code
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmoschini committed Apr 14, 2022
1 parent a20b3ff commit bcc53de
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StrictMode } from "react";
import { render } from "react-dom";
import { ReactNode, StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import "./index.css";
import { App } from "./components/App";
Expand All @@ -20,7 +20,21 @@ appSessionStateMonitor.start();

const queryClient = new QueryClient();

render(
// Temporal solution to patch react-query:
// https://github.com/tannerlinsley/react-query/issues/3476#issuecomment-1092424508
// Anyway, it does not seems to be a good idea:
// https://github.com/tannerlinsley/react-query/issues/3476#issuecomment-1092501739
declare module "react-query/types/react/QueryClientProvider" {
interface QueryClientProviderProps {
children?: ReactNode;
}
}

const container = document.getElementById(
appServices.appConfiguration.appElementId
);
const root = createRoot(container!);
root.render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<BrowserRouter basename={appServices.appConfiguration.basename}>
Expand All @@ -33,8 +47,7 @@ render(
</AppServicesProvider>
</BrowserRouter>
</QueryClientProvider>
</StrictMode>,
document.getElementById(appServices.appConfiguration.appElementId)
</StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down

0 comments on commit bcc53de

Please sign in to comment.