For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/apis/app/runtime/core/create-root.md.
  • 简体中文
  • createRoot

    用于创建 Modern.js 提供的根组件,该根组件会自动注册 Runtime 插件,并完成 Runtime 插件初始化。

    使用姿势

    import { createRoot } from '@modern-js/runtime/react';

    函数签名

    export function createRoot(
      UserApp?: React.ComponentType | null,
    ): React.ComponentType<any>;

    参数

    • UserApp 可选参数,默认为 App.tsx 导出的组件