stale-while-revalidate
https://github.com/vercel/swr
swr中文文档 https://swr.vercel.app/zh-CN
https://zhuanlan.zhihu.com/p/95089948
import useSWR from 'swr'
function Profile() {
const { data, error } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
return <div>hello {data.name}!</div>
}