Question about prerender

Friends, I am new to redwood. I have some questions about prerender. Basically, if I opt for prerender, I am expecting to see the web content on page source, but unfortunately not currently. Is there anything I missed out?

Welcome @thomas

When you run yarn rw prerender you should get static html files in the web/dist/ folder. Is this not what you’re seeing?

I ran the command and I saw it. The prerender is not for development right?

No :slight_smile:

To test prerendering the easiest way is to run

yarn rw build
yarn rw serve

And then load the page with JS turned off


Isn’t the page re-hydrated though? So initially the static HTML loads, and then is replaced by the identical React-rendered version, so that navigating somewhere new, or interacting with the page in any way will work?

Correct. Which is why I recommended loading the page with JS turned off.
Otherwise, often React will download and rehydrate the page so fast you won’t even realize it was showing you the prerendered version first.

Turning JS off will just display the static HTML file you get from the server as if it was 1994 again :slight_smile:

1 Like