useSWR with Next.js api and nested routes #2178
-
Beta Was this translation helpful? Give feedback.
Answered by
Ultrasonic1209
Oct 1, 2022
Replies: 1 comment 1 reply
-
You should be using |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
leo-fe99
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should be using
useSWR("/api/foo", fetcher)
.The
/
at the very beginning is important as it signals to the browser to start from the root of the website, not from wherever your path happens to be.