项目
在 GitHub 查看
bvaughn/suspense
关于
Utilities for working with React Suspense
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文suspense
APIs to simplify data loading and caching. Primarily intended for use with React Suspense.
⚠️ Considerations
- Suspense is an experimental, pre-release feature; these APIs will change along with React.
- This package depends on
react@experimentalandreact-dom@experimentalversions.
Example
import { createCache } from "suspense";
const userProfileCache = createCache({
load: async ([userId]) => {
const response = await fetch(`/api/user?id=${userId}`);
return await response.json();
},
});
function UserProfile({ userId }) {
const userProfile = userProfileCache.read(userId);
// ...
}
More examples at suspense.vercel.app.
If you like this project, buy me a coffee.
探索相关项目
加载中…