From 9246511981b3410d00b4adc31d1fd1e94c1074f7 Mon Sep 17 00:00:00 2001 From: JulesB <62644404+Youllou@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:37:21 -0400 Subject: [PATCH] Strict mode moved to Component root and not App root (#62) --- src/App.tsx | 9 +++++++- src/Pages/FormPage/FormPage.tsx | 40 +++++++++++++++++---------------- src/Pages/HomePage/HomePage.tsx | 28 ++++++++++++----------- src/main.tsx | 5 ++--- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 86bb8f95..330db890 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,17 +5,24 @@ import NoPage from "./Pages/NoPage/NoPage"; import "./App.css"; import Header from "./Components/Header/Header"; import FormPage from "./Pages/FormPage/FormPage"; +import { StrictMode } from "react"; function App() { return ( -
+ +
+ + } /> + } /> }/> + } /> + diff --git a/src/Pages/FormPage/FormPage.tsx b/src/Pages/FormPage/FormPage.tsx index b2b11e8f..3b3d91af 100644 --- a/src/Pages/FormPage/FormPage.tsx +++ b/src/Pages/FormPage/FormPage.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, useEffect } from "react"; +import React, { useState, useRef, useEffect, StrictMode } from "react"; import "./FormPage.css"; import Modal from "../../Components/Modal/Modal"; import openIcon from "../../assets/dot-menu.svg"; @@ -377,25 +377,27 @@ const FormPage = () => { return ( -
-
- -
-
- { - loading - ? - (
-
-

Votre fichier est en cours d'analyse Your file is being analyzed

-
) - : - [...data.sections].map((sectionInfo: section) => { - return sectionFactory(sectionInfo); - }) - } + +
+
+ +
+
+ { + loading + ? + (
+
+

Votre fichier est en cours d'analyse Your file is being analyzed

+
) + : + [...data.sections].map((sectionInfo: section) => { + return sectionFactory(sectionInfo); + }) + } +
-
+ ); }; diff --git a/src/Pages/HomePage/HomePage.tsx b/src/Pages/HomePage/HomePage.tsx index f85ffbb9..716916a1 100644 --- a/src/Pages/HomePage/HomePage.tsx +++ b/src/Pages/HomePage/HomePage.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { StrictMode, useState } from "react"; import "./HomePage.css"; import DragDropFileInput from "../../Components/DragDropFileInput/DragDropFileInput"; import FileList from "../../Components/FileList/FileList"; @@ -52,19 +52,21 @@ function HomePage() { }; return ( -
-
- - - + +
+
+ + + +
-
+ ); } diff --git a/src/main.tsx b/src/main.tsx index f25366e5..6fa20644 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,9 @@ -import React from "react"; +//import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App.tsx"; import "./index.css"; ReactDOM.createRoot(document.getElementById("root")!).render( - - , + );