repo_description: React Hooks for Data Fetching
repo_topics: cache data data-fetching fetch hook hooks nextjs react react-native stale-while-revalidate suspense swr vercel
code: import type { SWRInfiniteKeyLoader } from './types'
  import { serialize } from '../_internal/utils/serialize'
  import { INFINITE_PREFIX } from '../_internal/constants'
  
  export const getFirstPageKey = (getKey: SWRInfiniteKeyLoader) => {
    return serialize(getKey ? getKey(0, null) : null)[0]
  }
  
  export const unstable_serialize = (getKey: SWRInfiniteKeyLoader) => {
    return INFINITE_PREFIX + getFirstPageKey(getKey)
  }
  