Replies: 2 comments
-
Yes, you can use Material UI together with // pages/index.js
import React from "react";
import Container from "@material-ui/core/Container";
import Typography from "@material-ui/core/Typography";
import Box from "@material-ui/core/Box";
import ProTip from "../src/ProTip";
import Link from "../src/Link";
import Copyright from "../src/Copyright";
export default function Index(props) {
// contains test
console.log(props);
return (
<Container maxWidth="sm">
<Box my={4}>
<Typography variant="h4" component="h1" gutterBottom>
Next.js example
</Typography>
<Link href="/about" color="secondary">
Go to the about page
</Link>
<ProTip />
<Copyright />
</Box>
</Container>
);
}
export async function getStaticProps(context) {
return {
props: {
test: "test"
}
};
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, thank you a lot. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, please help, I need to use
getStaticProps
in order to read markdown files and parse them to react on build time.But my docs site is using material UI, so, as in this example
https://github.com/mui-org/material-ui/blob/master/examples/nextjs/pages/_document.js
I need to use
getInitialProps
in_document
to fix an issue with client/server css class names mismatch.If I try to do this I have an error, that I can't mix usage of getStaticProps and getInitialProps
So I tried to just replace getInitialProps by getStaticProps in the
_document
and it's not working.Does anybody know that in theory, it's possible to use SSR materialui altogether with getStaticProps or I should not even try and don't waste my time?
Previously I used
preval
for build-time data processing, so maybe I should get back to this approach instead of tryinggetStaticProps
?Beta Was this translation helpful? Give feedback.
All reactions