Gatsby: Does gatsby provides the option for using SSR?

Created on 1 Oct 2017  Â·  6Comments  Â·  Source: gatsbyjs/gatsby

Hi!

I noticed you have the gatsby SSR module but Im having a hard time understanding how to use it. Is there an example somewhere?
Does it support React16? (and utilizes SSR specific methods like hydrate)

and can I make my app partly static and partly SSR?

Thank you!!!!

question or discussion

Most helpful comment

All 6 comments

Hi @aviramga
Gatsby is using React 15.6.2 atm but for sure soon the move to React 16 will be made.

There is a full set of examples in the documentation section : https://www.gatsbyjs.org/docs/
You can also look at the starters, and the source plugins, which - for most - contains an example site hosted on the repo.

About Hydrate, it doesn't seem like Gatsby is using it, but still covers many functionnalities of Hydrate.
See this :

Thanks @sebastienfi ! I cannot find an server side rendering example anywhere in the docs.....
Do you know if its possible to have the app both with static page and server side rendered pages?

Gatsby is a static site generator :)

It is possible to do both using Gatsby, have a look at this https://github.com/gatsbyjs/gatsby/issues/2258

@sebastienfi he's referring to the new hydrate function in React 16.

You can start using React 16 with this plugin https://www.gatsbyjs.org/packages/gatsby-plugin-react-next/

The next major release of Gatsby will ship with React 16.

On static vs. dynamic — Gatsby is made with React so any page component can be dynamic as you want after loading in the client using AJAX calls, Redux, Apollo, etc.

You can also create client-only routes using React Router https://www.gatsbyjs.org/docs/creating-and-modifying-pages/#creating-client-only-routes

Thanks for the answer @KyleAMathews ! Im asking about server side rendering in specific. I know Gatsby can be used to build SPA's but I want to be able to render dynamic content before page render. Is this possible? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benstr picture benstr  Â·  3Comments

timbrandin picture timbrandin  Â·  3Comments

signalwerk picture signalwerk  Â·  3Comments

brandonmp picture brandonmp  Â·  3Comments

3CordGuy picture 3CordGuy  Â·  3Comments