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

Add an example based on the material-ui nextjs example #18

Closed
janus-reith opened this issue Aug 25, 2021 · 1 comment
Closed

Add an example based on the material-ui nextjs example #18

janus-reith opened this issue Aug 25, 2021 · 1 comment

Comments

@janus-reith
Copy link

janus-reith commented Aug 25, 2021

I would like to see an example how to integrate tss-react based on this: https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript

The current way things work is a bit confusing to me:
The example in the MUI docs has a shared util createEmotionCache which when called, always returns the result of emotions createCache function.

Now both _app and _document call that, _document uses it once in initial props, _app stores it global to the file.

The example here acts in a different way: The createDocument function returns getInitialProps logic, which internally uses getCache.
There is no _app, but I assume looking at what index.tsx does is the same what _app would do per page. index.tsx also uses the same getCache function.
What getCache basically does, is it stores a cache globally, and returns in or if it doesn't exist yet, create it using createCache from emotion.
That seems to be different from what the mui example does, since _document and _app receieve their own instance here.

Some more background to why this example would help understanding the cache utilization is in #19.

Having an example using the same structure as the MUI one would help a lot to understand the differences there.

@garronej
Copy link
Owner

gitbook-com bot pushed a commit that referenced this issue Jan 23, 2022
gitbook-com bot pushed a commit that referenced this issue Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants