The behavior you're describing is part of Next.js's server-side rendering capabilities, specifically the use of Server Components. Server Components in Next.js allow you to write UI that can be rendered and optionally cached on the server. The rendering work is split by route segments to enable streaming and partial rendering. This means that when you change the search parameters, Next.js only needs to fetch and render the differences, which can improve performance and user experience ^1^.
To display a loading status next to a specific element of the page, you can use the loading.js file convention or a Suspense component. The loading.js file provides a way to show a loading state for a whole route or route-segment, while the Suspense component allows you to display a fallback until components nested within it have finished loading ^2^.
Here's an example of how you might use the Suspense component to show a loading state for a specific part of your UI:
import { Suspense } from 'react';
import { PostFeed, Weather } from './components';
export default function Posts() {
return (
<section>
<Suspense fallback={<p>Loading feed...</p>}>
<PostFeed />
</Suspense>
<Suspense fallback={<p>Loading weather...</p>}>
<Weather />
</Suspense>
</section>
);
}
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: