Hamza-Liaqat1 / next-static-query

Example of SSG with complex query

Home Page:next-static-query-oqvg.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

This is an example of SSG working with a complex query via a custom hook.

It's not a perfect solution, but it allows you to switch from SSG to SSR without changing the whole project. Just comment out getStaticPaths and change the getStaticProps function to getServerSideProps and voila, you just switched from static pregeneration to fully working SSR and you don't need to do anything inside the project because it supports single interface ParsedUrlQuery

And of course the main idea is to make complex filters with SSG.

If you're thinking of doing an NPM package that would be great since I don't have a lot of time.

Otherwise, you can clone and copy the hook and use it.

About

Example of SSG with complex query

next-static-query-oqvg.vercel.app


Languages

Language:TypeScript 96.7%Language:JavaScript 1.8%Language:CSS 1.5%