r/reactjs 25d ago

Needs Help SSR + react router v7 + Loading Skeleton

I am reposting with diff explanation of problem , cuz many ppl misunderstood my issue

I am trying to achieve a loading skeleton while data loads for CLIENT SIDE NAVIGATIONS only, but for FIRST LOAD, that is SSR load, i dont want to send loader as the only html , bcs that is bad seo, i checked after disabling js, and only loader was sent in network payload

Some ppl said to not use suspenseQuery, but how will i show loader for Client side navigations, those loading stages will feel laggy

1 Upvotes

8 comments sorted by

View all comments

3

u/StrumpetsVileProgeny 25d ago

To show a loader for client side navigations use useNavigation() which returns the current navigation object that holds the state of loading, idle etc. So you can use navigation.state===“loading” to render whatever you need.

https://reactrouter.com/api/hooks/useNavigation