Jul 17, 2024
pages
directory:
getStaticProps
to fetch data and render HTML.getServerSideProps
to fetch latest data at request time.revalidate
option in getStaticProps
to regenerate page within a time interval.npx create-next-app <app-name>
to create a new project.npm run dev
to start the dev server on localhost:3000
._app.js
is the main entry point.pages
directory for each route.[param].js
).useRouter
hook to access query parameters from the URL.api
directory for server-side routes.getStaticProps
to fetch data from APIs or databases.Head
component to add titles and meta tags for SEO.getStaticPaths
to provide all available paths for dynamic routes.getServerSideProps
function.