Skip to content

Commit eba17a4

Browse files
committed
refactor: migrate to createRoot and update image paths
1 parent 950f1e4 commit eba17a4

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
} from "react-router";
99
import App from "./App";
1010
import React, { useEffect } from "react";
11-
import ReactDOM from "react-dom";
11+
import { createRoot } from "react-dom/client";
1212
import reportWebVitals from "./reportWebVitals";
1313
import ReactGa from "react-ga";
1414
import * as Sentry from "@sentry/react";
1515
import Loading from "./components/Loading/Loading";
1616

17-
const tracking_ID =
17+
const trackingID =
1818
process.env.REACT_APP_GOOGLE_ANALYTICS_API_KEY ?? "G-0BG1LNPT11";
19-
ReactGa.initialize(tracking_ID);
19+
ReactGa.initialize(trackingID);
2020

2121
Sentry.init({
2222
dsn: "https://[email protected]/4504348314435584",
@@ -34,15 +34,18 @@ Sentry.init({
3434
release: "devBcn@" + process.env.npm_package_version,
3535
});
3636

37-
ReactDOM.render(
37+
const rootElement = document.getElementById("root");
38+
if (!rootElement) throw new Error("Failed to find the root element");
39+
const root = createRoot(rootElement);
40+
41+
root.render(
3842
<React.StrictMode>
3943
<React.Suspense fallback={<Loading />}>
4044
<BrowserRouter>
4145
<App />
4246
</BrowserRouter>
4347
</React.Suspense>
4448
</React.StrictMode>,
45-
document.getElementById("root"),
4649
);
4750

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

src/views/Home/components/Faqs/components/FaqsCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const FaqCard: FC<React.PropsWithChildren<FaqCardType>> = ({ faq, index }) => {
2020
<Suspense fallback={<StyledLoadingImage src={Logo} />}>
2121
<StyledFaqImage
2222
alt={`DevBcn — image ${index}`}
23-
src={require(`../../../../../assets/images/FaqsImage${index}.jpg`)}
23+
src={`/images/FaqsImage${index}.jpg`}
2424
/>
2525
</Suspense>
2626
</StyledFaqImageContainer>

0 commit comments

Comments
 (0)