I have a problem in nextJS. I entered my website url and i went to my main page of website. I opened chrome devtools and i went to network tab. I saw that other pages had been downloaded! But i was in main page and i didnt go to any other page. Whats the problem here? How can i prevent something like this? Because it makes big problems in large apps! So my question is how can i prevent downloading unnecessary pages in nextJS? for example in plain react we could use React.lazy to download some components when we need them. we could use this method to prevent downloading unnecessary pages and components. like this exmple:
//App.js
import React, { Suspense } from "react";
import { Route, Routes } from "react-router-dom";
const SupportPage = React.lazy(() => import("./Components/SupportPage"));
const App = () => {
return (
<div>
<Suspense fallback={<p>loading the page...</p>}>
<Routes>
<Route path="/support" element={<SupportPage />} />
</Routes>
</Suspense>
</div>
)
}
but here, how can we do something like this? i have no idea about it. Thank you for helping.