author avatar

ayasha.pandey

Fri Oct 18 2024

the fallbackData parameter in useSWR to provide default data for your fetch request. This is super useful when you want to display initial data while waiting for the network request to resolve. The fallback data will be used as the initial value for the data until the fetcher returns the actual data.



const {
  data,
  mutate,
  error,
} = useSWR(endpoint, fetcherFunction, {
  fallbackData: initialData,
});


#swr #hook