react-dom/server#renderToStaticMarkup JavaScript Examples
The following examples show how to use
react-dom/server#renderToStaticMarkup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: render.js From jsonapi-react with MIT License | 6 votes |
export async function renderWithData(element, client, config) {
const { render } = {
render: renderToStaticMarkup,
...config,
}
const content = render(element)
const promises = client.cache.map(q => q.promise).filter(Boolean)
if (promises.length) {
await Promise.all(promises)
return renderWithData(element, client, config)
}
return [content, client.extract()]
}
Example #2
Source File: render.jsx From volto-slate with MIT License | 5 votes |
serializeNodesToHtml = (nodes) =>
renderToStaticMarkup(serializeNodes(nodes))