Replies: 1 comment
-
You're on the right track! Are you trying to fetch from an API route inside your Next.js application? If so, you can move that logic directly into In your current implementation, export async function getStaticPaths() {
return {
paths: [
{ params: { id: '1' } }
],
fallback: true
};
} It will now render a route at |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello community I have a problem passing parameters from the dynamic path to my component, I'm using
getStaticPaths
andgetStaticProps
I'm following the documentation to the letter (I think..haha)https://nextjs.org/docs/basic-features/data-fetching#fallback-pages
If I use some public API I don't have any problem (the parameters are passed correctly to my component) the problem is when I try to test with the URL of my site, I've tried using my localhost (I don't know if it's the ideal for testing) and the only thing I get is the legend "socket hang up" I don't know if I should deploy my site for everything to work properly.
From what I understand getStaticPaths will have the paths, in this case I use fallback true not to define all the paths that's why I need to trap the parameters of my path, now with getStaticProps it will get the parameters and pass them to my component.
Now I have doubts
Am I doing something wrong?
Am I putting getStaticProps and getStaticPaths to good use?
Am I misunderstanding the documentation?
I add my code in case something is not clear
I'd really appreciate your help.
Beta Was this translation helpful? Give feedback.
All reactions