Reputation: 1749
I have a situation where at the base of the url I have a dynamic slug that fetches data. Now I find I need a static slug after that which will signify a different page but still can access the base dynamic slug for information.
Example Paths
/formABC (page1)
/formABC/complete (page2)
page1 fetches data based on the dynamic slug but knows it isn't on the "complete" page
page2 fetches data based on the dynamic slug (formABC) but knows it's on the complete page
Current Folder Structure
pages/
[formName].js
So 1, is this possible with next.js?
And 2 any jumping-off points I should try (file structure, predefined next methods)?
Upvotes: 4
Views: 1765
Reputation: 50248
That's possible with the following folder structure:
pages/
[formName]/
complete.js
index.js
With each pages having its own data fetching method.
Upvotes: 3