Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140762

How to implement SSR for an already built react app with CRA?

$
0
0

We have a react app already built with CRA and Router. We want to implement SSR on it so that we can have proper SEO and social media support. I have seen and tried a number of techniques available for this but none of these seems to work.

We made our app in such a way that a lot of it actually depends upon browser to work properly, for example on the window object. One technique (kind of) worked but running the code on the server side gives the error;

ReferenceError: 'window' is not defined

The main reason we want to implement SSR is SEO and social media recognition of the site. We are adding meta tags dynamically (using React Hemlet) so facebook, twitter etc. are unable to get the tags.

So now the questions are;

  1. Is there a proper way to implement SSR on an already built react site?

  2. Is there any alternative we can use? The site has a large amount of resources fetched from remote API endpoints so prerendering is not an option.


Viewing all articles
Browse latest Browse all 140762

Latest Images

Trending Articles



Latest Images