Questions tagged [server-side-rendering]

Serverside rendering is a technique for rendering a client-side app on the server.

Rendering a client application on the server results in a faster experience for end users since they do not have to wait for assets to load before they can see and interact with an app. This is accomplished by using isomorphic code: code which is used on both the server and the client.

4406 questions
17
votes
0 answers

Angular5 Server side rendering, external Api data service does not work in ssr

I have set up and used successfully Angular5 + SSR. It is still pretty nice. All components work well on SSR and Non-SSR. And there are some services which call external HTTP get APIs to get some data. Of course, it works well on a Non-SSR mode.…
Jihoon Kwon
  • 745
  • 5
  • 14
16
votes
6 answers

How to turn off CSS module feature in Next.js?

Next.js only allow to import Global CSS in _App.js. But we can't import global CSS in every component , for that we have to use CSS module as per the restriction by Next.js. Now I am migrating a large project to Next.js and it is very difficult to…
16
votes
7 answers

How to use cookie inside `getServerSideProps` method in Next.js?

I have to send current language on endpoint. But getting language from Cookie returns undefined inside getServerSideProps. export async function getServerSideProps(context) { const lang = await Cookie.get('next-i18next') const res = await…
Mammad Mammadli
  • 310
  • 1
  • 2
  • 9
16
votes
1 answer

What is the difference between `isomorphic-fetch` and `isomorphic-unfetch` npm packages

I see both are used for SSR. So what's the difference? Apart from isomorphic-fetch being older and slightly larger gzipped package. Links: Isomorphic Unfetch Isomorphic Fetch
Somjit
  • 2,503
  • 5
  • 33
  • 60
16
votes
2 answers

Pass data to getServerSideProps from previous page in NextJS

I am developing an e-commerce like website using NextJS. I will fetch & display list of products in /products page. On clicking any product, I'll navigate to /details/[productId], and I'll fetch those product details as follows. // In…
Ganesh
  • 1,820
  • 2
  • 20
  • 40
16
votes
2 answers

ReactGA.initialize must be called first

I am getting the following warning multiple times (for multiple pages) despite me initializing at the root of my app. This makes me wonder if google analytics is even working properly? [react-ga] ReactGA.initialize must be called first or…
16
votes
2 answers

Server side rendering with next.js vs traditional SSR

I am very used to the approach where SSR meant that the page got a full refresh and received a full HTML from the server, where it gets rendered with razor/pub/other depending on the backend stack. So every time the user would click on the…
16
votes
3 answers

Angular 7 - Service Worker PWA + SSR not working on server

I am struggling to make my Server Side Rendering and Service Worker cooperate on server Side. Information regarding localhost -> Working This is working as expected. The service worker works and updates my app on every update. Moreover; a curl…
16
votes
5 answers

Update meta tags in angular universal with external API call

I've spent more than 2 months but could not found a clear solution of how to proceed with angular universal. I've already spent about 6 months in implementing angular universal on a project for which I don't get a much time and now I'm stuck with…
Black Mamba
  • 13,632
  • 6
  • 82
  • 105
16
votes
4 answers

(Angular 6) Angular Universal - Not waiting on content API call

Cannot get SSR to work when using Angular Universal with pages that use dynamic content. All other pages work and the dynamic pages return with HTML but do not include the dynamic data. Method Called: ngOnInit() { const div =…
Smokey Dawson
  • 8,827
  • 19
  • 77
  • 152
16
votes
3 answers

How to format time in React SSR rendered page using client time zone?

I'm building a website with React and recently switched to using server-side rendering (SSR) for improved performance. One issue I ran into after this change is that when I format a time on the page (I'm using Moment.js) it renders incorrectly using…
Liron Yahdav
  • 10,152
  • 8
  • 68
  • 104
16
votes
5 answers

Using Fragment to insert HTML rendered on the back end via dangerouslySetInnerHTML

I used to compile and insert JSX components via
which wrapped my HTML into a
:
my html from the HTML object
Now react > 16.2.0 has support for Fragments and I wonder…
Dominik
  • 6,078
  • 8
  • 37
  • 61
15
votes
1 answer

NextJS: getStaticProps revalidate not working

I have this NextJS site where there is this getStaticProps that load data from Firestore. I have this: return { props: { allPosts: posts, }, revalidate: 60, } where from what I know will load data from firebase every one minute.…
15
votes
4 answers

Using redux with redux-persist with server-side rendering

I am trying to implement redux 4.0.0 with redux-persist 5.10.0 in an SSR application and am running into an issue where I cannot properly supply createStore() with the preloaded state without the app crashing. What happens is that the application…
Gurnzbot
  • 3,742
  • 7
  • 36
  • 55
15
votes
2 answers

Nested routes in Next js

I have a simple SPA and the App and About components are like below. When I click on About link, the about page appears under the links. The problem is that when I click on "About me" link, the "me" page loads instead of about page. What I really…
Hadi Ranjbar
  • 1,692
  • 4
  • 21
  • 44