File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
core/src/main/scala/japgolly/scalajs/react Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,24 @@ trait React extends Object {
9191 @deprecated("As of React 0.14, you must use ReactDOMServer.renderToStaticMarkup instead.", "0.10.0")
9292 def renderToStaticMarkup(e: ReactElement): String = js.native
9393 */
94+
95+ /**
96+ * Render a ReactElement to its initial HTML. This should only be used on the server. React will return an HTML
97+ * string. You can use this method to generate HTML on the server and send the markup down on the initial request for
98+ * faster page loads and to allow search engines to crawl your pages for SEO purposes.
99+ *
100+ * If you call `ReactDOM.render()` on a node that already has this server-rendered markup, React will preserve it and
101+ * only attach event handlers, allowing you to have a very performant first-load experience.
102+ */
94103 def renderToString (e : ReactElement ): String = js.native
104+
105+ /**
106+ * Similar to [[renderToString ]], except this doesn't create extra DOM attributes such as `data-react-id`, that React
107+ * uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the
108+ * extra attributes can save lots of bytes.
109+ */
95110 def renderToStaticMarkup (e : ReactElement ): String = js.native
111+
96112 // ===================================================================================================================
97113}
98114
You can’t perform that action at this time.
0 commit comments