Disable default convert to static?
Answered
Red-necked Grebe posted this in #help-forum
Red-necked GrebeOP
hi i have question,
but the compiler decided to compile all in client, even inside the page.tsx there is server render (hardcoded), can i disable it so it would partially render page in server then the header in client?
thanks in advance
page
- page.tsx << this is "use server"
/element
- header.tsx << this is "use client"but the compiler decided to compile all in client, even inside the page.tsx there is server render (hardcoded), can i disable it so it would partially render page in server then the header in client?
thanks in advance
Answered by joulev
that is [static rendering](https://nextjs.org/docs/app/building-your-application/rendering/server-components#static-rendering-default), not client components.
static rendering = the page is rendered at build time, so it can be cached and is much faster.
do you want to switch to dynamic rendering (the page is rendered at request time)? if so, add
if you have used the pages router, static rendering is like
static rendering = the page is rendered at build time, so it can be cached and is much faster.
do you want to switch to dynamic rendering (the page is rendered at request time)? if so, add
export const revalidate = 0 to the page.if you have used the pages router, static rendering is like
getStaticProps while dynamic rendering is like getServerSideProps.5 Replies
@Red-necked Grebe hi i have question,
page
- page.tsx << this is "use server"
/element
- header.tsx << this is "use client"
but the compiler decided to compile all in client, even inside the page.tsx there is server render (hardcoded), can i disable it so it would partially render page in server then the header in client?
thanks in advance
1.
2. page.tsx should already be a server component. to confirm you can
use server is not the directive to mark server components. remove it.2. page.tsx should already be a server component. to confirm you can
import "server-only" there@joulev 1. `use server` is not the directive to mark server components. remove it.
2. page.tsx should already be a server component. to confirm you can `import "server-only"` there
Red-necked GrebeOP
for point number 2
<div> component
tries using
<div> component
page.tsx marked as pre-render as statictries using
server-only but still opt this..or if there is no async-call , only jsx component with tailwind it would converted into static content?
@Red-necked Grebe for point number 2
<div> component `page.tsx` marked as pre-render as static
tries using `server-only` but still opt this..
that is [static rendering](https://nextjs.org/docs/app/building-your-application/rendering/server-components#static-rendering-default), not client components.
static rendering = the page is rendered at build time, so it can be cached and is much faster.
do you want to switch to dynamic rendering (the page is rendered at request time)? if so, add
if you have used the pages router, static rendering is like
static rendering = the page is rendered at build time, so it can be cached and is much faster.
do you want to switch to dynamic rendering (the page is rendered at request time)? if so, add
export const revalidate = 0 to the page.if you have used the pages router, static rendering is like
getStaticProps while dynamic rendering is like getServerSideProps.Answer
@joulev that is [static rendering](<https://nextjs.org/docs/app/building-your-application/rendering/server-components#static-rendering-default>), not client components.
static rendering = the page is rendered at build time, so it can be cached and is much faster.
do you want to switch to dynamic rendering (the page is rendered at request time)? if so, add `export const revalidate = 0` to the page.
if you have used the pages router, static rendering is like `getStaticProps` while dynamic rendering is like `getServerSideProps`.
Red-necked GrebeOP
oh yea that's works
so
also on demand rendering should not put
ok got it
so
use server has no effect on component (rather is effective on server action),also on demand rendering should not put
user server on the file aboveok got it