File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const ReactDOMServer = require ( "react-dom/server" ) ;
4+
5+ exports . renderToString = ReactDOMServer . renderToString ;
6+
7+ exports . renderToStaticMarkup = ReactDOMServer . renderToStaticMarkup ;
Original file line number Diff line number Diff line change 1+ module React.Basic.DOM.Server
2+ ( renderToString
3+ , renderToStaticMarkup
4+ ) where
5+
6+ import React.Basic (JSX )
7+
8+ -- | Render a React element to its initial HTML. React will return an HTML string.
9+ -- | You can use this method to generate HTML on the server and send the markup
10+ -- | down on the initial request for faster page loads and to allow search engines
11+ -- | to crawl your pages for SEO purposes.
12+ -- |
13+ -- | If you call `ReactDOM.hydrate` on a node that already has this server-rendered
14+ -- | markup, React will preserve it and only attach event handlers, allowing you to
15+ -- | have a very performant first-load experience.
16+ foreign import renderToString :: JSX -> String
17+
18+ -- | Similar to `renderToString`, except this doesn’t create extra DOM attributes
19+ -- | that React uses internally, such as `data-reactroot`. This is useful if you
20+ -- | want to use React as a simple static page generator, as stripping away the
21+ -- | extra attributes can save some bytes.
22+ -- |
23+ -- | If you plan to use React on the client to make the markup interactive, do not
24+ -- | use this method. Instead, use `renderToString` on the server and `ReactDOM.hydrate`
25+ -- | on the client.
26+ foreign import renderToStaticMarkup :: JSX -> String
You can’t perform that action at this time.
0 commit comments