How to create static pages using T3 stack?

Title, for now I need to create only SOME static pages, but I have no idea how to set them up with next, what I need to add to make them static? Thanks!
8 Replies
nexxel
nexxel3y ago
if you don't use any react stuff in your page, next will automatically make it a static page if you want to fetch data you will need to use getStaticProps
rocawear
rocawear3y ago
Also good way to check how nextjs renders is to build your app to see what pages are static and what runs on server (it shows it after build)
Kenzo
KenzoOP3y ago
@rocawear but I want to create react components etc Not only plain html
nexxel
nexxel3y ago
if they have any interactivity they can't be static pages you can still create components just can't use useState, etc
rocawear
rocawear3y ago
Nextjs with SSG have opinion for revalidation. Can that be used to add interactivity for pages? Or react query with hydration? I have no experience but wanted to give my 5cents for the topic, also would like to know the answer. Atm not on computer so cant test by myself
Kenzo
KenzoOP3y ago
And what about the interactivity between pages? The navigator
BarisP
BarisP3y ago
You are already doing it, next makes pages automatically static if you are already putting the content by hand in the codebase. You can use getStaticProps to have the content be created for you at build time too if you like.
nexxel
nexxel3y ago
that willl work to use react query the react dom will have to be loaded so yes not a static page only way to load data is through getStaticProps
Want results from more Discord servers?
Add your server