返回 Skill 列表
extension
分类: 开发与工程无需 API Key

managing-loading-states

用于Suspense边界和骨架屏加载的逻辑。用以防止在数据获取期间布局偏移。

person作者: jakexiaohubgithub

Loading States and Skeletons

When to use this skill

  • Data fetching pages (Tour List, Details).
  • Button submittals.

Techniques

  • Suspense: Wrap async components in <Suspense fallback={<Skeleton />} >.
  • Skeleton Cards: Match the height and width of the actual Tour Card.
  • Progressive Loading: Load text first, then images.

Instructions

  • No Layout Shift: Ensure skeletons have exact dimensions to prevent jumping content.
  • Visuals: Use a subtle pulse animation for skeletons.