Skip to content
New issue

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

MUI Component styling not working with renderToStaticMarkup #3008

Open
david-ic3 opened this issue Mar 14, 2023 · 2 comments
Open

MUI Component styling not working with renderToStaticMarkup #3008

david-ic3 opened this issue Mar 14, 2023 · 2 comments

Comments

@david-ic3
Copy link

david-ic3 commented Mar 14, 2023

I raised the question in MUI that asked me to put it here, here I am : mui/material-ui#36496


Not sure how to reopen closed issue, so I open another one ( mui/material-ui#33864 and #2102 )

Link to live example:

https://codesandbox.io/s/autumn-morning-3mdyj7?file=/demo.tsx

Result :
The emotion cache is not getting styles, so it's not possible to inject them back to the 'actual' react node.

Context :
We have in our React application components done in javascript that can have some custom renderers done in React (small components). We need to get the html of those and inject in javascript, including styling.

It's a regression we had moving to React 18

@knutmarius
Copy link

Also having a similar problem where I need to render some react components to strings in order to work with non-react libraries, and the styles are messed up after moving to React 18. The workaround I have found is quite dirty and I'd really like to be able to solve this in a more proper way. Did you find a solution for this, @david-ic3 ?

@david-ic3
Copy link
Author

@knutmarius , what we do is ensuring React components that support renderToStaticMarkup do not use styled components (it's a few components only for us). Looks as neither MUI or Emotion-JS want to fix this :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants