Hacker News new | ask | show | jobs
by wildpeaks 3981 days ago
Personally, the only things I had to do to prerender full pages with React were:

- prepend '<!DOCTYPE html>' to the resulting HTML

- attribute "prefix" in head tag "<title>" wasn't outputted, so until it's fixed in the library, I just use a data attribute "data-replace-prefix" and removed the extra "data-replace-" from the resulting HTML

-------

Also, he could include inline scripts (like Google Analytics) this way:

  return <script dangerouslySetInnerHTML={{__html: "THE_JS_CODE"}}></script>;