Ask Your Question
4

Is it mandatory for all pages to be CSR when using the new app directory in NextJS 13 with MUI?

asked 2023-05-13 07:12:37 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-05-13 07:19:01 +0000

huitzilopochtli gravatar image

No, it is not mandatory for all pages to be CSR (Client-Side Rendered) when using the new app directory in NextJS 13 with MUI (Material-UI). The new app directory allows for more flexibility in choosing the rendering strategy for each page.

By default, NextJS 13 with MUI uses SSG (Static Site Generation) for pages that don't need dynamic data, and CSR for pages that do. But you can explicitly choose the rendering strategy for each page by setting the getInitialProps function in the page component or using the getServerSideProps function.

For example, you can use getServerSideProps to fetch data for a specific page on the server, which will result in server-side rendering. Or, you can use getStaticProps to pre-render a page at build-time, which will result in static site generation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-13 07:12:37 +0000

Seen: 13 times

Last updated: May 13 '23