-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix support for mui #5016
Fix support for mui #5016
Conversation
🦋 Changeset detectedLatest commit: 5090af1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
how to use?
How to use? |
This is huge! Astro with React+MUI. Thanks so much! @LuckyArd110 : the way I used MUI was pretty much standard, added it to a React component, then consumed that component in a .astro page. Can't say I've tried lots of mui styling, but I can confirm the following works: |
were you able to use the theme provider of mui with astro/react? |
Yes, I got mui more or less to work in a .jsx component that itself I import into a .astro page and then use But I found by trial and error that not all mui components work in dev mode, and even fewer compile without error in production mode usually because of some dependency that vite doesn't agree with. So you have to try out the mui components you wish to use in dev and prod mode until you see if the ones you are interested in work. If it helps, I got these ones to work: import { Fragment, useRef, useState, useEffect } from 'react' (<= not mui, but to give you context) |
@antonymott if the custom theme aslo works? did you try that? that uses emotion cache etc. which I believe has to stay only on UI. |
@krnbr haven't tried that. I just looked back at my comment yesterday and the markdown somehow hid the most important part which is the template directive |
Changes