-
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
Code splitting with one SPA page #1379
Comments
I thought this was a relevant snippet from the new react-router 4.0 docs on Code-splitting + server rendering:
|
@thisbejim the flick is due to the page fetching. Try doing some prefetching. We'll land import support soon and we are experimenting it here. |
I'm gonna close this since we've a separate issue where we discussed about this. |
@thisbejim it's absolutely possible. Go to http://zeit.co and navigate around. I also have recently come up with a very simple solution to do lazy loading + route transitions which I'll share soon! |
Thanks @rauchg and yes I can confirm this is definitely possible, this was down to user error on my part. Looking forward to hearing about your new lazy loading solution! |
@rauchg @thisbejim @arunoda any news about that? I'm quite interested too! |
Awesome, so I've tried import and it seems to work fine but how do you refresh a dynamic component? (https://github.com/zeit/next.js/tree/import-then/examples/with-dynamic-import) |
@MarcMagnin what do you mean by refreshing? |
Sorry I was meaning that I want to change that Component on the fly by clicking on a button ie: |
@MarcMagnin please open a new issue for that. I know what you are referring to. |
ok will do. |
@thisbejim @rauchg are there any tutorials/walk-throughs for how this working? We have an application thats re rendering the navigation, background, etc and we're trying to get that to stop but its very unclear how to make that happen. |
Because an application re-renders when changing a page it seems like it is not possible to have a persistent navbar that doesn't flicker across multiple pages (frame rate doesn't catch first flicker):
The solution in this comment here is to have only one page (index.js) and just change the route query and use that to render whatever sub components/pages you'd like, as demonstrated in nextgram and react-overdrive. This means you can just mount the navbar once, which is great!
My only concern is that by going the one index page route you lose the automatic code splitting that comes with next - how might you address that in next's current state? I can see there are some conversations about supporting
import
in the future but what can we do today?The text was updated successfully, but these errors were encountered: