Skip to content

Commit 732f471

Browse files
committed
Merge pull request facebook#1186 from chenglou/doc-toString-opt
[Docs] document optional param for renderComponentToString
2 parents 7807413 + 071d2a9 commit 732f471

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/docs/ref-01-top-level-api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,12 @@ string renderComponentToString(ReactComponent component)
104104
Render a component to its initial HTML. This should only be used on the server. React will return an HTML string. You can use this method to generate HTML on the server and send the markup down on the initial request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
105105

106106
If you call `React.renderComponent()` on a node that already has this server-rendered markup, React will preserve it and only attach event handlers, allowing you to have a very performant first-load experience.
107+
108+
109+
### React.renderComponentToStaticMarkup
110+
111+
```javascript
112+
string renderComponentToStaticMarkup(ReactComponent component)
113+
```
114+
115+
Similar to `renderComponentToString`, except this doesn't create extra DOM attributes such as `data-react-id`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.

0 commit comments

Comments
 (0)