Next.js Discord

Discord Forum

Loading.tsx doesnt work

Answered
Asian black bear posted this in #help-forum
Open in Discord
Avatar
Asian black bearOP
I have a page.tsx in the same folder as loading.tsx, its all part of a tutorial
page.tsx
export default async function Page() { return(<div>main page</div>);} 

loading.tsx
export default function Loading() {
  return <div>Loading</div>;
}

when I refresh the page I can see "main page" the tutorial said that I should see "Loading"

why is it not working ?
Answered by James4u
well, your Page doesn't have any async operation that takes time
View full answer

3 Replies

Answer
Avatar
so that's why you don't see the loading UI but see the page immediately
Avatar
@James4u well, your Page doesn't have any async operation that takes time
Avatar
Asian black bearOP
that is it thank you, i made SetTimeInterval for 3 seconds and now I can see it , thanks ❤️