Search Docs
用于渲染项目组件。
import { render } from '@modern-js/runtime/browser'; render(<ModernRoot />);
export function render(App: React.ReactElement, id?: HTMLElement | string): Promise<any>;
App
createRoot
id
"root"
import { createRoot } from '@modern-js/runtime/react'; import { render } from '@modern-js/runtime/browser'; const ModernRoot = createRoot(); async function beforeRender() { // todo } beforeRender().then(() => { render(<ModernRoot />); });