Next.js Discord

Discord Forum

how to create instance

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

8 Replies

Avatar
Dwarf Hotot
uh just fetch()?
by default all components and pages are rendered on server so fetch is also a server thing now
Avatar
Weevil parasitoidOP
I don't want to pass the API URL 127.0.0.1:5000/api to fetch
example for client
Image
Avatar
Dwarf Hotot
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
Avatar
Weevil parasitoidOP
this example normal?
Image
Avatar
Dwarf Hotot
if its a external api yes if its a nextjs api route just put api route functionality to component