Letting the user to pick Web Components and use them to create a Static page (???)
Unanswered
West African Lion posted this in #help-forum
West African LionOP
Hi there,
I'm new to Next.js, and I'm trying to implement a feature that seems simple, but I'm a bit stuck. Here's the flow I want to achieve:
1) The user can view a list of Web Components (retrieved from MongoDB). These components are built using any stack the user chooses. They can add, remove, and update them at any time.
2) The user selects a few Web Components from the list.
3) The user clicks a button, and the app generates a static page (SPA) that can be served by a CDN, containing the selected Web Components (❓).
I'm unsure how to implement step 3 in Next.js. (Is it even possible to generate static pages dynamically like this with Next.js?)
Any help or guidance would be greatly appreciated!
Note: the Web Component are not part of the code at all.... they are dynamically fetch from a DB (or a repo)
Many thanks!
I'm new to Next.js, and I'm trying to implement a feature that seems simple, but I'm a bit stuck. Here's the flow I want to achieve:
1) The user can view a list of Web Components (retrieved from MongoDB). These components are built using any stack the user chooses. They can add, remove, and update them at any time.
2) The user selects a few Web Components from the list.
3) The user clicks a button, and the app generates a static page (SPA) that can be served by a CDN, containing the selected Web Components (❓).
I'm unsure how to implement step 3 in Next.js. (Is it even possible to generate static pages dynamically like this with Next.js?)
Any help or guidance would be greatly appreciated!
Note: the Web Component are not part of the code at all.... they are dynamically fetch from a DB (or a repo)
Many thanks!
2 Replies
@West African Lion Hi there,
I'm new to Next.js, and I'm trying to implement a feature that seems simple, but I'm a bit stuck. Here's the flow I want to achieve:
1) The user can view a list of Web Components (retrieved from MongoDB). These components are built using any stack the user chooses. They can add, remove, and update them at any time.
2) The user selects a few Web Components from the list.
3) The user clicks a button, and the app generates a static page (SPA) that can be served by a CDN, containing the selected Web Components (❓).
I'm unsure how to implement step 3 in Next.js. (Is it even possible to generate static pages dynamically like this with Next.js?)
Any help or guidance would be greatly appreciated!
Note: the Web Component are not part of the code at all.... they are dynamically fetch from a DB (or a repo)
Many thanks!
you can add on top of your customer page:
In combination with [generateStaticParams](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) to serve your dynamically fetched page, statically.
If you customer make changes you can revalidate your page and use ISR to generate a new static page
export const dynamic = 'force-static'In combination with [generateStaticParams](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) to serve your dynamically fetched page, statically.
If you customer make changes you can revalidate your page and use ISR to generate a new static page
@West African Lion solved?