For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/react/Interface.Root.md.
  • English
  • @lynx-js/react / Root

    Interface: Root

    The default root exported by @lynx-js/react for you to render a JSX

    Properties

    registerDataProcessors()

    registerDataProcessors: (dataProcessorDefinition: DataProcessorDefinition) => void;

    Register DataProcessors. You MUST call this before root.render().

    Parameters

    ParameterType
    dataProcessorDefinitionDataProcessorDefinition

    Returns

    void

    Deprecated

    use lynx.registerDataProcessors instead

    Defined in

    @lynx-js/react/runtime/lib/lynx-api.d.ts:60


    render()

    render: (jsx: ReactNode) => void;

    Use this API to pass in your JSX to render

    Parameters

    ParameterType
    jsxReactNode

    Returns

    void

    Examples

    import { root } from "@lynx-js/react"
    
    function App() {
      // Your app
      return <view>...</view>
    }
    
    root.render(<App/>);
    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
      })
    }

    Defined in

    @lynx-js/react/runtime/lib/lynx-api.d.ts:54

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.