r/reactjs • • Jul 28 '19

Server-client rendering technique spectrum

https://developers.google.com/web/updates/images/2019/02/rendering-on-the-web/infographic.png
623 Upvotes

48 comments sorted by

10

u/[deleted] Jul 28 '19

This table came in handy for me, while researching different techniques of rendering webapps/sites, especially React apps. (hashtag next.js, hashtag Gatsby)

Source: https://developers.google.com/web/updates/2019/02/rendering-on-the-web

1

u/Siiimo Jul 29 '19

That's a great resource. Thanks!

22

u/timne Jul 28 '19

Probably good to note that Next.js covers CSR with prerendering and full CSR too. You can choose the rendering strategy per page.

8

u/[deleted] Jul 28 '19

Right! That flexibility is what makes me curious about it at the moment.

5

u/KB1RMA Jul 28 '19

It's a really great framework. I just launched a fairly high profile site on it recently and think it's fantastic. Once your site gets more complex you'll find yourself customizing more and more. But Next out of the box is absolutely fantastic for getting up and running with SSR. Even more so with v9 and the auto static page features.

4

u/bjerh Jul 29 '19

We launched lego.com/kids on it a few years ago. Seems to do the job, alright. 😄

3

u/[deleted] Jul 28 '19

What's your experience with the next.js router? We had fair amount of issues with redirects and pushRoute.

2

u/KB1RMA Jul 29 '19

I haven't had any issues at all really - What have you been experiencing? We did have an accessibility related where the screenreader didn't announce on a page change, but that was a very easy workaround. Curious to hear what your issue was.

1

u/dreadful_design Jul 29 '19

What issues? I've had pretty good success. One has tow write a simple function to check for the response object but that's the only gotcha I ran into.

2

u/Cherlokoms Jul 29 '19

Do you have an example of a use case that Next would cover and Gatsby wouldn't?

3

u/greendog77 Jul 29 '19

interested as well :D

2

u/timne Jul 29 '19

The graph already highlights it, SSR with rehydration

1

u/ISkiAtAlta Jul 29 '19

Can you translate this into non-coder terms and give some examples please?

2

u/timne Jul 29 '19

Anything that is rendered on-demand basically, meaning dynamic data that has to be server-rendered.

1

u/greendog77 Jul 30 '19

gatsby allows you to have full-on react apps, right? so any dynamic data you want to fetch can be fetched eventually, just not on the server at first render?

43

u/silveredge7 Jul 28 '19

Can someone tell me what is TTI, FCP & TTFB ?!

53

u/JuicyORiley Jul 28 '19

TTI Time to Interactive

FCP First Contentful Paint

TTFB Time to First Bite

26

u/gbrunacci Jul 28 '19

Hope that bite does not hurt too much :)

21

u/gbrunacci Jul 28 '19

They are all times about something, user-centric first, technical/network last

TTI: Time to (user) interaction

FCP: First contentful paint

TTFB: Time to first byte (from server)

Edit: Line Breaks

2

u/[deleted] Jul 28 '19

I didn't know that Hacker News is on SSR. It just doesn't look like it is. https://news.ycombinator.com/

In gmail you can choose to use basic html, that's also SSR?

13

u/SeerUD Jul 28 '19

You can cache SSR with (Re)hydration, meaning TTFB can be as fast as Static SSR.

24

u/enteleform Jul 28 '19

Cons:
👎 Leads to hydration

r/HYDROHOMIES WANTS TO KNOW YOUR LOCATION

10

u/iamgigamesh Jul 28 '19

Could someone explain what streaming means in the context of this chart?

2

u/dreadful_design Jul 29 '19

It's a different way of sending files to the client. You can deliver essentially an array of small packets that make up the payload instead of waiting for the whole thing to send. It doesn't work very well if your components rely on data to render properly (some API data that you fetch on mount).

9

u/Noch_ein_Kamel Jul 28 '19

What's meant by "Flexible"/"Inflexible"?

Also it's missing SEO

7

u/iaan Jul 28 '19

Google bot is now using full chrome engine to crawl the pages

14

u/klarstrup Jul 28 '19

But it's still pretty wishy-washy how long it waits for the page to be populated, how many xhr requests it'll make max etc.. Server rendering is more reliable for SEO. Plus you can serve up status codes appropriately, 404'ing not found resources etc.

2

u/chewster1 Jul 29 '19 edited Jul 29 '19

It's a bit more nuanced than that.

Googlebot has been using a version of headless Chromium for a number of years. All that happened recently is that the Google WRS recently updated from v41 to v74 and going forward will have more frequent updates. This doesn't change things like SPAs and JS-only URLs going into the Render queue. This leads into an area of SEO where JS is concerned: crawl-budget optimisation.

Overlooking the impact of JS crawl/render budgets and blindly deploying JS only, content-heavy sites can have a large negative effect on organic traffic. This is often more noticeable where content life-cycles are short-lived (measured in hours, days or weeks) or have time-decay factor (eg: real-estate, events, job listings) and so any delay in crawl will have knock-on effects. Alternatively if there are a large number of pages (eg: ecommerce, marketplaces, user-created content) and a low domain authority (in the general sense, not Moz specific) meaning the site gets a small crawl-budget allocated from Google, then you have be be extremely careful with what 'consumes' the small crawl/render budget.

More info on this:

1

u/[deleted] Jul 29 '19

SEO and social were big decision points where I work. Gotta have those pretty pictures and well-formatted text up in the head so our stuff looks good when shared on social media. Which necessitates some form of SSR.

2

u/devjacks Jul 28 '19

Could someone explain to me what hydration means in this context?

3

u/RowbotWizard Jul 29 '19

Hydration is when a client side bundle is loaded after an initial view is delivered via HTML, layering in dynamic page behaviors (like interactivity).

1

u/randomNext Jul 28 '19

Basically it is just populating your instantiated objects with domain data.

1

u/[deleted] Jul 28 '19

Can someone explain to me why we put up with this crap and why it isn't much, much simpler? All I see in this doc is wasted developer time. Sure would be great if the W3C was tackling things like this instead of trying to break ad-blockers and ensure media conglomerate hegemony is maintained.

0

u/Fenris1729 Jul 29 '19

Personally I think SSR is disgusting, but obviously good for web crawlers

2

u/dreadful_design Jul 29 '19

Wait, why is it disgusting? How to implement it? The output is only good for the user.

2

u/Fenris1729 Jul 29 '19

I hate implementing UI on server side. SSR damages separation of concerns

2

u/dreadful_design Jul 29 '19

Huh? I'm unsure what you mean by "implementing UI on the server side". You write the same view logic that you would for the client and then just have the server compile it. SSR doesn't affect the way you write business logic if you don't want it to.

1

u/Fenris1729 Jul 29 '19

Well correct me if I’m wrong, but in my understanding SSR means using stuff like Jinja templating to render parametrised html on the backend, and sending it over to the UI. I’d much rather generate this html dynamically using react in a completely separate project, and simply use the backend to serve bundled react apps without touching any html

3

u/dreadful_design Jul 29 '19

render parametrised html

Parameters in html have nothing to do with SSR

I’d much rather generate this html dynamically using react

You can easily use react to implement SSR

and simply use the backend to serve bundled react apps without touching any html

The point of SSR is to not require the client to bootstrap the whole app after downloading your bundle. This reduces time to the user interacting with the application.

1

u/Fenris1729 Jul 29 '19

Well fair enough then

-9

u/paulqq Jul 28 '19

Thanks. I'll leave a comment to remember this later.

15

u/thatsrealneato Jul 28 '19

There’s a “save” function for that

0

u/[deleted] Jul 28 '19

[deleted]

10

u/[deleted] Jul 28 '19

Gatsby renders your site as static HTML files at BUILD time, which when served can be rehydrated.
Server side rendering in this context refers to rendering and returning a page from the server, as a direct response to the page request. Think express.js with a template system or even PHP..

0

u/[deleted] Jul 28 '19

[deleted]

-6

u/RemindMeBot Jul 28 '19

I will be messaging you on 2019-08-01 14:30:06 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback