-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Placeholder loading app while fetching data #2985
Comments
@dcatanzaro If the doubt was resolved, I suggest closing the subject 😸 |
@dcatanzaro I have it working in this issue, #2981 I am having a few issues on a dynamic level page but may work for what you are looking for. |
Thanks! I will see both. |
If you want to show some loading/placeholders just dont fetch on SSR, use componentDidMount and fetch when client kicks in and while fetching show your placeholder :) |
I'm trying to continue using SSR, and when it comes from de client-side use componentDidMount! Thanks!. |
Like @JustasPolis said when you use componentDidMount to fetch you can render the placeholder server side 👍 |
Hello ! Can someone provide an example of this ? I want my page to display "loading ..." until getInitialProps() Promise is resolved; so it is basically the same need than the one described in this issue. Should I use router events ? is there an example somewhere on how this has to be done ? Should i use a store to update a "pageLoading" variable ? Should I use componentDidMount ? I dont understand this suggestion, as i guess i will loose SSR if i use this method... Any help appreciated :) |
@nyl-auster https://github.com/zeit/next.js/tree/master/examples/with-loading might help |
@timneutkens definitely does, thanks ! Router.onRouteChangeStart = (url) => NProgress.start()
Router.onRouteChangeComplete = () => NProgress.done()
Router.onRouteChangeError = () => NProgress.done() |
👌 Happy it helped 😄
|
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
Hi.
Im using NextJS for a big project and I want to add a placeholder loading while fetching data.
Example:
Currently NextJS use fetch in getInitialProps and wait to fetch all data to show de render.
Is there a way to show the basic render with placeholder loading and in the background do the fetch?
Thanks!
The text was updated successfully, but these errors were encountered: