Next.js Discord

Discord Forum

how to create instance

Unanswered
Weevil parasitoid posted this in #help-forum
Open in Discord
Weevil parasitoidOP
how to create instance for server fecth?

8 Replies

Cinnamon
uh just fetch()?
by default all components and pages are rendered on server so fetch is also a server thing now
@Cinnamon by default all components and pages are rendered on server so fetch is also a server thing now
Weevil parasitoidOP
I don't want to pass the API URL 127.0.0.1:5000/api to fetch
example for client
Cinnamon
well just do api job in the component
server components are rendered in the server using external api calls to fetch data in rsc is dumb
Weevil parasitoidOP
this example normal?
Cinnamon
if its a external api yes if its a nextjs api route just put api route functionality to component