We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一直在使用easywebpack,项目有场景在运行时对样式的操作/变量的传值,需要使用styled-component,但在server端进行renderToString收集好component的样式表,append进
import { renderToString } from 'react-dom/server' import { ServerStyleSheet } from 'styled-components' const sheet = new ServerStyleSheet() try { const html = renderToString(sheet.collectStyles(<YourApp />)) const styleTags = sheet.getStyleTags() // or sheet.getStyleElement(); } catch (error) { // handle error console.error(error) } finally { sheet.seal() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一直在使用easywebpack,项目有场景在运行时对样式的操作/变量的传值,需要使用styled-component,但在server端进行renderToString收集好component的样式表,append进
The text was updated successfully, but these errors were encountered: