3 ms·
The SPA frameworks and web APIs available to us now are pretty good - browserHistory as you mention, is available via `window.history.pushstate` and abstracted
by jotto 10y ago
The SPA frameworks and web APIs available to us now are pretty good - browserHistory as you mention, is available via `window.history.pushstate` and abstracted away for you in most SPA frameworks.
> If built poorly, all of the browser features you've come to rely on break
Alternatively phrased: "you may have to learn some new APIs"
But the SEO can be an issue (Google is not consistently executing AJAX) and render performance is definitely an issue.
I made https://www.prerender.cloud/ https://www.prerender.cloud/ to address the SEO and rendering performance but that still doesn't make SPA the obvious choice.
Do you need a rich client experience? ( a UI that continuously updates to reflect the state of a data store, or more generally, a complicated UI that doesn't do a hard page refresh ) If yes, then SPA is the better solution.
If you just need a non-interactive set of pages (a blog), then a SPA probably isn't the answer.
> If not, 10MB of the hottest new JS framework may not be for you...
What hot new JS framework is 10MB? React is ~60kb gzipped
The auth frameworks (auth0.com or AWS Cognito) are large though, ~150KB gzipped. But with code splitting you can eliminate that from your main page. Or you can move the auth part of your app to a subdomain (app.example.com) and keep example.com lightweight w/out auth0/cognito)
- patmcguire 10y ago> you may have to learn some new APIs Yeah, but you have to then call those APIs. It's like buffer overflows, which can be prevented with trivial checking, but those checks have to be done everywhere, which is why they're still happening in 2017. It would be actively difficult to break back, links, or scrolling with server side rendering. Even on good SPA I run into bugs I have to work around on a daily basis.