I have a react app that works standalone and it uses styled-components.
(我有一个独立运行的react应用程序,它使用样式组件。)
For production deployment, I moved it to express server and i have below express config in app.js to load the react app.
(为了进行生产部署,我将其移至Express服务器,并且在app.js中有express配置,以加载react应用。)
// Serve the static files from the React app
(//从React应用提供静态文件)
app.use(express.static(path.join(__dirname, 'client/build')));
while the inline styles works fine, some of the styled-components styles don't work.
(尽管内联样式可以正常工作,但是某些样式化组件样式不起作用。)
I followed below llink but doesn't know how to apply it to my app which doesn't have shared styled components and every component has its own
(我遵循下面的llink,但不知道如何将其应用于没有共享样式组件且每个组件都有自己的应用程序)
https://github.com/styled-components/styled-components-website/blob/master/sections/advanced/server-side-rendering.md
(https://github.com/styled-components/styled-components-website/blob/master/sections/advanced/server-side-rendering.md)
2.1m questions
2.1m answers
60 comments
57.0k users