块编辑器开发文档

💡 云策文档标注

概述

本文档介绍了 Interactivity API 开发中的关键概念和思维模型,包括反应式与声明式编程、状态管理、服务器端渲染、TypeScript 使用和客户端导航等核心主题。

关键要点

  • 反应式与声明式思维:涵盖反应性和声明性的核心概念,为有效使用 Interactivity API 奠定基础。
  • 状态管理:解释如何有效使用全局状态、本地上下文和派生状态,强调根据数据范围和要求选择适当的状态管理技术。
  • 服务器端渲染:允许 WordPress 使用服务器端渲染创建交互式和状态感知的 HTML,与客户端功能平滑连接,同时保持性能和 SEO 优势。
  • TypeScript 使用:指导如何使用 TypeScript 与 Interactivity API 存储,涵盖从基本类型定义到处理复杂存储结构的高级技术。
  • 客户端导航:解释如何使用 @wordpress/interactivity-router 包实现客户端导航,通过仅更新页面变化部分来实现更快的页面过渡。
  • 客户端导航兼容性:解释如何声明块与客户端导航兼容,以及在评估兼容性时需要考虑的事项。

📄 原文内容

This section provides some guides on important concepts and mental models related to Interactivity API development. Use the following links to learn more:

  1. The Reactive and Declarative mindset: This guide covers core concepts of reactivity and declarativeness, providing a foundation for effective use of the Interactivity API.

  2. Understanding global state, local context, derived state and config: The guide explains how to effectively use global state, local context, and derived state within the Interactivity API emphasizing the importance of choosing the appropriate state management technique based on the scope and requirements of your data.

  3. Server-side rendering: Processing directives on the server: The Interactivity API allows WordPress to use server-side rendering to create interactive and state-aware HTML, smoothly connected with client-side features while maintaining performance and SEO benefits.

  4. Using TypeScript: This guide will walk you through the process of using TypeScript with Interactivity API stores, covering everything from basic type definitions to advanced techniques for handling complex store structures.

  5. Client-Side Navigation: This guide explains how to use the @wordpress/interactivity-router package to implement client-side navigation, enabling faster page transitions by updating only the parts of the page that change.

  6. Client-Side Navigation Compatibility: This guide explains how to declare that a block is compatible with client-side navigation and what to consider when evaluating compatibility.