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

# What is ReactLynx?

ReactLynx is the official React framework for Lynx. It allows you to develop Lynx native apps with a React mental model.

With ReactLynx, you can build your UI [using JSX and React components](https://react.dev/learn/describing-the-ui), just like you would on the web. ReactLynx turns your React code into calls to the [Lynx Engine](/next/guide/spec.md#engine) imperative API to render the native UI.

## Main Features

ReactLynx itself is an "idiomatic" React, but it also pioneered optimizations such as "dual-threaded React" and compiler-informed rendering.

- **"Idiomatic" React**: ReactLynx is an implementation of React, under the hood it is based on [Preact](https://github.com/preactjs/preact), so it has basically the same API and behavior as React, and this consistency allows many ecosystem constructions to be reused.
- **[Dual-threaded in Mind](/next/react/thinking-in-reactlynx.md)**: ReactLynx follows the programming model of React, but by utilizing the **dual-threaded runtime** provided by Lynx, combined with its own programming paradigm (or rules) to achieve better performance and user experience.
  - **[Off-main-thread](/next/guide/spec.md#background-thread-aka-off-main-thread) Reconciliation**: ReactLynx puts some Reconciliation logic into the background thread to reduce the amount of calculation in the main thread and improve performance.
  - **[Lifecycle under dual-thread architecture](/next/react/lifecycle.md)**: Due to the dual-thread architecture of Lynx, the lifecycle of ReactLynx is slightly different from that of traditional React in terms of calling timing.
- **[Compiler-Informed Rendering](/next/react/compiler-informed-rendering.md)**: ReactLynx extracts static JSX structures into a reusable compiled representation so the runtime can focus on dynamic values and subtrees.

## For React Web Developers

### Change your `import`

Since it has the same API as [`react`](https://www.npmjs.com/package/react), you can directly replace `react` with `@lynx-js/react`, and continue to use the React API you are familiar with.

```diff
- import { useState } from 'react';
+ import { useState } from '@lynx-js/react';
```

For a full list of APIs ReactLynx implemented, please refer to the [`@lynx-js/react` API documentation](/next/api/react/index.md).

### Different component sets

Unlike elements such as `div` and `span` on the Web, Lynx provides a set of native component sets, such as `view`, `text`, `image`, etc ([full list](/next/api/elements/built-in/view.md)).
In ReactLynx, you can [combine](/next/guide/ui/elements-components.md) these elements to build your native UI.

```diff
- <div className="..." />
+ <view className="..." />
```

While the naming of native components is similar to React Native, ReactLynx do have some differences:

```diff
- import {View, Text, Image} from 'react-native';
- <View style={{...}} />
+ <view style={{...}} />
```

### Different event naming

Based on Lynx, ReactLynx uses a different set of event naming than the Web (go to [Events](/next/guide/interaction/event-handling.md) to learn more).

> **Event propagation is also different**
> 
> For commonly used Web methods such as `e.stopPropagation()` and `e.preventDefault()`, Lynx only supports [`e.stopPropagation()`](/next/api/lynx-api/event/event.md#stoppropagation) in [Main Thread Scripts](/next/react/main-thread-script.md). But Lynx's [Event Propagation Mechanism](/next/guide/interaction/event-handling/event-propagation.md) allows you to implement similar functions or effects as on the Web.
> 


```diff
- <button onTouchStart={...} />
+ <view bindtouchstart={...} catchtouchstart={...}/>
```

### No `document` and `window`

Lynx does not yet provide `document` and `window` objects, so ReactLynx does not support these two objects either.

> **No "DOM"?**
> 
> Lynx Engine provides a set of Low Level Element APIs that allow [Framework Developers](/next/guide/spec.md#scripting-framework-developer) to create UI through JavaScript running in the [Main Thread](/next/guide/spec.md#main-thread-or-lynx-main-thread).
> But this set of APIs is not open to all developers.
> Lynx encourages developers to use declarative methods to build UI as much as possible,
> rather than directly manipulating the DOM.
> But Lynx also provides the ability to [Directly Manipulate Elements](/next/guide/interaction/event-handling/manipulating-element.react.md) and [Main Thread Scripts](/next/react/main-thread-script.md),
> which are generally used to help developers maintain a near-native user experience when implementing some complex interactions.
> 


This means that you cannot use any libraries that depend on `document` or `window`.

There are basically two ways for this difference:

- Most of the time, Lynx provides the feature with a different API. For example, you can use the APIs under the `lynx` object like [`lynx.reload`](/next/api/lynx-api/lynx/lynx-reload.md) to replace `window.location.reload()`.
- Occasionally, Lynx does not provide the feature. You can use Lynx's [NativeModules](/next/guide/use-native-modules.md) and [Custom Elements](/next/guide/custom-native-component.md) to extend Lynx's capabilities.

## Next Steps

### Further Learning ReactLynx

- [Thinking in ReactLynx](/next/react/thinking-in-reactlynx): Learn how to think in the ReactLynx framework

- [Rendering Process and Lifecycle](/next/react/lifecycle): Understand the rendering process and lifecycle of ReactLynx


Continue with [Compiler-Informed Rendering](/next/react/compiler-informed-rendering.md) and [Main Thread Scripts](/next/react/main-thread-script.md) to learn more about rendering and main-thread interactions.

### Build ReactLynx Applications

Choose a section based on what you want to do:

- [Guides](/next/react/best-practices): Explore best practices, code splitting, React Compiler, and code testing

- [Integrations](/next/react/data-fetching): Use ecosystem solutions for data fetching, state management, routing, and Generative UI


**Extra Topics**: Consult the [API Reference](/next/api/react/index.md) and use [Framework Performance Profiling](/next/guide/performance/analysis-performance/analysis-framework.md) to investigate performance issues.

### Learn Lynx Basics

If you haven't already, you should learn the basics of Lynx.

- [Elements](/next/guide/ui/elements-components): Check out the built-in elements that Lynx provides

- [Styling](/next/guide/ui/styling): Learn how to apply different styles in Lynx





- [Layout](/next/guide/ui/layout): Layout your elements and Components

- [Scrolling](/next/guide/ui/scrolling): Learn how to use scrollable elements in Lynx

