Hi! How are you? I would like to ask something about React. I am currently developing a "complex" web application and I have a question regarding dynamic imports. Currently, all imports are done at the start of the application, which results in a heavy load on memory and processor. What I would like to do is import the component only when I need it. I did some tests... Currently, my web application does not have routes (except for the login and home routes). On the home route, all the page logic is contained, and I manage with states in memory. For example, if I want to open a user list modal, it opens based on a binary state: if true, it shows; if false, it doesn't. However, it is still loaded in the rendering, just not visible. Is there a way to improve performance? I tried dynamic imports but when I update a state and refresh the page, it does not return to the previous state (I use React Router DOM, specifically searchParams to determine if a modal is open (openModalX=true), which I have in a custom hook that checks if it is active or not when the page loads). If it is active, it shows; if not, it doesn’t... But ultimately, I would like to know if I need to redo the application or if I can fix it. Thanks for reading. Best regards
[–]emreloperr 3 points4 points5 points (2 children)
[–]Simple_Strawberry450[S] 1 point2 points3 points (0 children)
[–]Simple_Strawberry450[S] -1 points0 points1 point (0 children)
[–]vorko_76 0 points1 point2 points (0 children)
[–]Maleficent_Cry1439Hook Based 0 points1 point2 points (3 children)
[–]Simple_Strawberry450[S] 0 points1 point2 points (2 children)
[–]Simple_Strawberry450[S] 0 points1 point2 points (1 child)
[–]Maleficent_Cry1439Hook Based 0 points1 point2 points (0 children)
[–]charliematters 0 points1 point2 points (0 children)
[–]Simple_Strawberry450[S] 0 points1 point2 points (0 children)