> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# Interface: Root

`@lynx-js/react` 默认导出的 root，用于渲染 JSX

## Properties

### ~~registerDataProcessors~~

> **registerDataProcessors**: (`dataProcessorDefinition`: [`DataProcessorDefinition`](/next/zh/api/react/Types/DataProcessorDefinition.md)) => `void`

注册 DataProcessor。必须在 `root.render()` 之前调用。

#### Parameters

| Parameter                 | Type                                                                             |
| ------------------------- | -------------------------------------------------------------------------------- |
| `dataProcessorDefinition` | [`DataProcessorDefinition`](/next/zh/api/react/Types/DataProcessorDefinition.md) |

#### Returns

`void`

#### Deprecated

请改用 [lynx.registerDataProcessors](/next/zh/api/react/Types/Lynx.md#registerdataprocessors)

***

### render

> **render**: (`jsx`: `ReactNode`) => `void`

使用此 API 传入要渲染的 JSX

#### Parameters

| Parameter | Type        |
| --------- | ----------- |
| `jsx`     | `ReactNode` |

#### Returns

`void`

#### Examples

```ts
import { root } from "@lynx-js/react"

function App() {
  // Your app
  return <view>...</view>
}

root.render(<App/>);
```

```tsx
import { root } from "@lynx-js/react"

function App() {
  // Your app
  return <view>...</view>
}

if (__MAIN_THREAD__) {
  root.render(
    <DataProvider data={DEFAULT_DATA}>
       <App/>
    </DataProvider>
  );
} else if (__BACKGROUND__) {
  fetchData().then((data) => {
    root.render(
      <DataProvider data={data}>
         <App/>
      </DataProvider>
    ); // You can render later after your data is ready
  })
}
```
