MCPcopy
hub / github.com/reactGo/reactGo / renderFullPage

Function renderFullPage

app/server.jsx:32–59  ·  view source on GitHub ↗
(renderedContent, initialState, head={
  title: 'React Webpack Node',
  meta: '<meta name="viewport" content="width=device-width, initial-scale=1" />',
  link: '<link rel="stylesheet" href="/assets/styles/main.css"/>'
})

Source from the content-addressed store, hash-verified

30 * @param head - optional arguments to be placed into the head
31 */
32function renderFullPage(renderedContent, initialState, head={
33 title: 'React Webpack Node',
34 meta: '<meta name="viewport" content="width=device-width, initial-scale=1" />',
35 link: '<link rel="stylesheet" href="/assets/styles/main.css"/>'
36}) {
37 return `
38 <!doctype html>
39 <html lang="">
40
41 <head>
42 ${head.title}
43
44 ${head.meta}
45
46 ${head.link}
47 </head>
48 <body>
49 <div id="app">${renderedContent}</div>
50
51 <script>
52 window.__INITIAL_STATE__ = ${JSON.stringify(initialState)};
53 </script>
54 <script type="text/javascript" charset="utf-8" src="/assets/app.js"></script>
55 </body>
56 </html>
57
58 `;
59}
60
61/*
62 * Export render function to be used in server/config/routes.js

Callers 1

renderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected