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

createRoot

It is used to create the root component provided by Modern.js, which will automatically register Runtime plugins and complete the initialization of Runtime plugins.

Usage

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

Function Signature

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

Parameters

  • UserApp: an optional parameter, and the default is the component exported from App.tsx.