custom renderToHtml function 'meta' parameter does not affect renderMeta prop passed to Document
See original GitHub issueBUG: I was attempting to implement emotion-js following the styled-components example and have been unable to attach any data to the “meta” object and that data be available to the renderMeta prop passed to the Document
Environment
- react-static version: 5.9.7
- node version: 10.4.0
- npm version: 6.1.0
- Operating system: macOS High Sierra 10.13.5
- Browser and version (if relevant): n/a
Steps to Reproduce the problem
import { extractCritical } from 'emotion-server';
...
renderToHtml: (render, Comp, meta) => {
const { html, ids, css } = extractCritical(render(<Comp/>));
meta.css = css;
meta.ids = ids;
return html;
},
Document: class CustomHtml extends Component {
render() {
const {
Html,
Head,
Body,
children,
renderMeta,
} = this.props
console.log("renderMeta: ", renderMeta);
return (
<Html>
<Head>
<meta charSet = "UTF-8" />
<meta name = "viewport" content = "width=device-width, initial-scale=1"/>
</Head>
<Body>
{children}
</Body>
</Html>
)
}
}
the console.log("renderMeta: ", renderMeta);
logs an empty object. should that not be an object with the properties css
and ids
?
I’ve been unable to pass any value to the renderMeta object from the renderToHtml function when attaching properties to the 3rd meta parameter
https://react-static.js.org/docs/config#rendertohtml https://react-static.js.org/docs/config#document
Expected Behavior
any property attached to the “meta” object passed into renderToHtml should be available on the renderMeta prop passed to the custom Document in the config
Reproducible Demo
see code above
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
No it shouldn’t be necessary, since it’s embedding the styles directly into the html
On Wed, Jun 27, 2018 at 9:30 PM Michael Raumer notifications@github.com wrote:
Isn’t that what happens anyway?