Next.js Discord

Discord Forum

MUI deprecetad with app folder and server components ?

Unanswered
DollarNavalex posted this in #help-forum
Open in Discord
Avatar
DollarNavalexOP
Hey guys,

I'm trying to migrate a website to the new app directory, but I'm using MUI actively on all the website, and any import from MUI seems to needs a client components.
So my question is simple: does MUI is still a viable choice for Next.js ? Is there other libs that can better fit in this engine without leaving too much from MUI design and components ?

Thanks

19 Replies

Avatar
Alfonsus Ardani
yes
however its not fully supported yet in app dir, coz it uses emotion, which is css-in-js
you can still SSR apps that use MUI
Avatar
DollarNavalexOP
Yeah i think i didn't get everything with the new server components
Is just components which can do api calls etc server side ?
If i get it, even a client component can still be SSR ?
It just be populated client-side with my useEffects i guess*
Avatar
Alfonsus Ardani
Yep
Yeah
Id u want cc to be ssrd it has to have initial state usestate
Basically the initial JSX must be present and populated with data already
Avatar
DollarNavalexOP
Hmm okay, does my states can be empty objects ?
Or it will make them render client-side ?
Avatar
Alfonsus Ardani
If its empty objects then you wont get any initial data :/
Fetch the data on the server and pass it down to client components
Avatar
DollarNavalexOP
Hmm okay i see
And i have a last question then: until now, i was using Zustand to store my API data and be able to access it anywhere in my app. But with server-side fetching, I can't put this data in zustand, or i can but by passing it to a cc. Is there any way to make a server-side store, that can be updated on the fly ?
Avatar
DollarNavalexOP
Maybe i can just use the fetch api with a little lifetime cache (some seconds) and stop persisting data's ?
Avatar
DollarNavalexOP
Nvm, i made another post for this topic, thanks for your help here 😉