Giter VIP home page Giter VIP logo

Comments (8)

jamietdavidson avatar jamietdavidson commented on April 27, 2024 6

And awesome work on Mui Joy, it is leaps and bounds easier to work with than material. Global variants is an amazing idea, and overriding the default props within the theme is genius.

from material-ui.

samuelsycamore avatar samuelsycamore commented on April 27, 2024 1

@jamietdavidson It sounds like you'll need to move the exported metadata to a Server Component. This is a Next.js specific issue, so your best bet from here would be to seek help on Stack Overflow. Best of luck! This new paradigm of Server and Client Components can be really tricky to untangle. If you don't have a specific need for the App Router, I might suggest reverting to the Pages Router so you don't have to worry about this stuff at all.

from material-ui.

samuelsycamore avatar samuelsycamore commented on April 27, 2024

Hey Jamie 👋 This error message is correct:

Error: Attempted to call getInitColorSchemeScript() from the server but getInitColorSchemeScript is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.

You're calling {getInitColorSchemeScript()} in layout.tsx which is a Server Component—you'll need to add the "use client" directive to that file as well for it to work.

from material-ui.

jamietdavidson avatar jamietdavidson commented on April 27, 2024

Hi @samuelsycamore !

Thanks for the reply. I suppose I don't understand the mechanics of Next 14 too well yet. I am then faced with:

You are attempting to export "metadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive

Removing the export prevents my page from having a name when looking at my tabs. What would you recommend I try next?

from material-ui.

jamietdavidson avatar jamietdavidson commented on April 27, 2024

@samuelsycamore Will do! Thanks for the timely help :)

from material-ui.

samuelsycamore avatar samuelsycamore commented on April 27, 2024

Cheers @jamietdavidson! I think @siriwatknp deserves most of the praise for Joy UI so hopefully he sees this! 😁

from material-ui.

oliviertassinari avatar oliviertassinari commented on April 27, 2024

You're calling {getInitColorSchemeScript()} in layout.tsx which is a Server Component—you'll need to add the "use client" directive to that file as well for it to work.

@samuelsycamore getInitColorSchemeScript shouldn't need to be a client component.

from material-ui.

oliviertassinari avatar oliviertassinari commented on April 27, 2024

Duplicate of #39010

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.