A discussion on data fetching in Nextjs: Adding types to requests and response and using the fetch API
Context
I’ve been building a web app with nextjs and a custom backend in Django Python and I’ve been struggling to find a clean way to make API requests to my backend from Nextjs. What I’m looking for is a way to centralise the logic for the fetch function while adding type safety to the request body and responses.