Aug 20, 2024
getStaticProps
to fetch data and pass it as props.getServerSideProps
to fetch data at request time.revalidate
option in getStaticProps
.npx create-next-app <app-name>
to create a new Next.js app.npm run dev
to start the development server on localhost:3000.globals
file for global styles..module.css
files for route/component specific styles.pages
directory.hello.js
in pages
directory.localhost:3000/hello
to see the new page./cars
).index.js
for listing and [param].js
for dynamic components.useRouter
hook to access URL parameters.api
directory.getStaticProps
inside component files.params
argument to access URL data during data fetching.Head
component to include SEO-friendly titles and meta tags.getStaticPaths
to return available paths for dynamic routes.getServerSideProps
to implement SSR.