> 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.

# 用 Explorer 体验

- 用 Explorer 体验: 在预构建的沙盒应用中即时运行 Lynx 页面 (iOS, Android, HarmonyOS, Web, macOS, Windows)
- [集成到现有应用](/next/zh/guide/start/integrate-with-existing-apps): 在原生或 Web 应用中将 Lynx 作为 UI 基座 (iOS, Android, HarmonyOS, Web, macOS, Windows)
- [使用应用框架构建](/next/zh/guide/start/build-with-app-framework): 基于 Lynx 应用框架，从零构建移动或桌面应用 (iOS, Android, macOS, Windows)


使用 [Lynx Explorer](https://github.com/lynx-family/lynx)（一个预构建的沙盒应用）来即时开发和预览 Lynx 页面，无需配置原生工具链。非常适合学习、原型开发和日常开发。要部署到生产环境，请[集成到现有应用](/next/zh/guide/start/integrate-with-existing-apps.md)或[使用应用框架从零构建](/next/zh/guide/start/build-with-app-framework.md)。

### 系统要求

- [Node.js 20.19](https://nodejs.org/zh-cn) 或更新的版本，也支持 Node.js 22.12 或更新的版本

### 创建一个 Lynx 项目

推荐通过 [`@lynx-js/create-lynx`](https://www.npmjs.com/package/@lynx-js/create-lynx) 来快速创建一个 Lynx 项目，执行：


```sh [npm]
npm create @lynx-js/lynx@latest
```

```sh [yarn]
yarn create @lynx-js/lynx
```

```sh [pnpm]
pnpm create @lynx-js/lynx@latest
```

```sh [bun]
bun create @lynx-js/lynx@latest
```

```sh [deno]
deno init --npm @lynx-js/lynx@latest
```

创建时会让你选择构建工具：搭配 [`pluginReactLynx`](/next/zh/api/packages/react-rsbuild-plugin/functions/pluginReactLynx.md) 的 [Rsbuild](https://rsbuild.rs/)（推荐）、[Rspeedy](/next/zh/guide/build/rspeedy.md)，或用于组件库的 [Rslib](https://rslib.rs/)。跟随提示来创建一个 Lynx 项目。

### 准备 Lynx Explorer

Lynx Explorer 是一个可以快速试用 Lynx 的沙盒环境。

iOS SimulatorAndroidHarmonyOS

目前我们仅提供 iOS 模拟器的预编译二进制文件。如果你需要在真实 iOS 设备上运行 Lynx Explorer，则需要从源代码构建。请参考[为 iOS 构建 Lynx Explorer](https://github.com/lynx-family/lynx/tree/develop/explorer/darwin/ios) 指南。

:::info
社区贡献者在 [App Store](https://apps.apple.com/us/app/lynx-go-dev-explorer/id6743227790) 上提供了 Lynx Explorer 的版本。
虽然此版本未经 Lynx 团队审核和维护，但我们感谢社区让开发者能够更方便地在 iOS 上尝试 Lynx。
:::

1. **安装 Xcode**

打开 Mac App Store，搜索 [Xcode](https://apps.apple.com/us/app/xcode/id497799835)，点击安装（如果已安装则点击更新）。

2. **下载 LynxExplorer**

macOS (arm64)macOS (x86_64)

下载 [`LynxExplorer-arm64.app.tar.gz`](https://github.com/lynx-family/lynx/releases/download/4.2.0/LynxExplorer-arm64.app.tar.gz)。

然后，解压下载的压缩包：

```bash
mkdir -p LynxExplorer-arm64.app/
tar -zxf LynxExplorer-arm64.app.tar.gz -C LynxExplorer-arm64.app/
```

3. **在模拟器上安装 LynxExplorer**

打开 Xcode，从 Xcode 菜单中选择 **Open Developer Tool**。点击 **Simulator** 选项以启动一个模拟器，然后将 LynxExplorer-arm64.app 拖入模拟器中完成安装。

下载 [`LynxExplorer-x86_64.app.tar.gz`](https://github.com/lynx-family/lynx/releases/download/4.2.0/LynxExplorer-x86_64.app.tar.gz)。

然后，解压下载的压缩包：

```bash
mkdir -p LynxExplorer-x86_64.app/
tar -zxf LynxExplorer-x86_64.app.tar.gz -C LynxExplorer-x86_64.app/
```

3. **在模拟器上安装 LynxExplorer**

打开 Xcode，从 Xcode 菜单中选择 **Open Developer Tool**。点击 **Simulator** 选项以启动一个模拟器，然后将 LynxExplorer-x86_64.app 拖入模拟器中完成安装。

扫描二维码从 [GitHub Release 4.2.0](https://github.com/lynx-family/lynx/releases/tag/4.2.0) 下载预编译应用。

[LynxExplorer-noasan-release.apk](https://github.com/lynx-family/lynx/releases/download/4.2.0/LynxExplorer-noasan-release.apk)
或者，你可以按照[为 Android 构建 Lynx Explorer](https://github.com/lynx-family/lynx/tree/develop/explorer/android) 指南从源代码构建。

:::info
社区贡献者在 [Play Store](https://play.google.com/store/apps/details?id=com.funcs.io.lynx.go) 上提供了 Lynx Explorer 的版本。
虽然此版本未经 Lynx 团队审核和维护，但我们感谢社区让开发者能够更方便地在 Android 上尝试 Lynx。
:::

目前我们仅提供 Harmony 模拟器的预编译二进制文件。如果你需要在真实 Harmony 设备上运行 Lynx Explorer，则需要从源代码构建。请参考[为 Harmony 构建 Lynx Explorer](https://github.com/lynx-family/lynx/tree/develop/explorer/harmony) 指南。

1. **安装 DevEco Studio**

从 [官网](https://developer.huawei.com/consumer/cn/deveco-studio/) 下载最新的 DevEco Studio。

2. **下载 Lynx Explorer**

下载预编译应用 [`lynx_explorer-default-unsigned.hap`](https://github.com/lynx-family/lynx/releases/download/4.2.0/lynx_explorer-default-unsigned.hap)。

或者，你可以按照[为 Harmony 构建 Lynx Explorer](https://github.com/lynx-family/lynx/tree/develop/explorer/harmony) 指南从源代码构建。

3. **在模拟器上安装 Lynx Explorer**

```bash
hdc install lynx_explorer-default-unsigned.hap
```

### 开始开发

1. 进入 Lynx 项目：

```bash
cd <project-name>
```

2. 安装依赖：


```sh [npm]
npm install
```

```sh [yarn]
yarn install
```

```sh [pnpm]
pnpm install
```

```sh [bun]
bun install
```

```sh [deno]
deno install
```

3. 启动开发服务器：


```sh [npm]
npm run dev
```

```sh [yarn]
yarn run dev
```

```sh [pnpm]
pnpm run dev
```

```sh [bun]
bun run dev
```

```sh [deno]
deno run npm:dev
```

您将看到终端中出现一个二维码，请使用您的 Lynx Explorer 应用扫描。如果您正在使用模拟器，只需复制捆绑 URL 并粘贴到 Lynx Explorer 应用中的"Enter Card URL"输入框中，然后点击"Go"。

4. 进行第一次更改：

在代码编辑器中打开 `src/App.tsx` 文件并进行更改。

你应该会看到 Lynx Explorer 上的 UI 自动更新。

**下面是一个示例: hello-world**

**Bundle:** `dist/main.lynx.bundle` | Web: `dist/main.web.bundle`

```tsx
import { useCallback, useEffect, useState } from "@lynx-js/react";

import "./App.css";
import arrow from "./assets/arrow.png";
import lynxLogo from "./assets/lynx-logo.png";
import reactLynxLogo from "./assets/react-logo.png";

export function App() {
  const [alterLogo, setAlterLogo] = useState(false);

  useEffect(() => {
    console.info("Hello, ReactLynx");
  }, []);

  const onTap = useCallback(() => {
    "background-only";
    setAlterLogo(!alterLogo);
  }, [alterLogo]);

  return (
    <page>
      <view className="Background" />
      <view className="App">
        <view className="Banner">
          <view className="Logo" bindtap={onTap}>
            {alterLogo
              ? <image src={reactLynxLogo} className="Logo--react" />
              : <image src={lynxLogo} className="Logo--lynx" />}
          </view>
          <text className="Title">React</text>
          <text className="Subtitle">on Lynx</text>
        </view>
        <view className="Content">
          <image src={arrow} className="Arrow" />
          <text className="Description">Tap the logo and have fun!</text>
          <text className="Hint">
            Edit<text style={{ fontStyle: "italic", color: "rgba(255, 255, 255, 0.85)" }}>{" src/App.tsx "}</text>
            to see updates!
          </text>
        </view>
        <view style={{ flex: 1 }}></view>
      </view>
    </page>
  );
}

```

v0.7.0





### 调试应用

访问 [Lynx DevTool](https://github.com/lynx-family/lynx-devtool/releases) 下载并打开 Lynx DevTool 桌面应用，使用数据线连接正在运行 Lynx 的设备，开始调试应用。

访问[调试工具](/next/zh/guide/devtool/panels.md)，学习如何调试应用。

## 下一步

以下是我们建议接下来探索的一些内容，你可以按任意顺序阅读它们。

### ReactLynx 框架

ReactLynx 是 Lynx 的官方 React 框架，学习如何用 React 的方式构建 Lynx 页面。

- [教程：产品双列](/next/zh/learn/gallery): 手把手教你用 Lynx 构建瀑布流产品双列

- [ReactLynx 思维方式](/next/zh/react/thinking-in-reactlynx): 学习 ReactLynx 的编程模型和思维


### 描绘界面

Lynx 能够让你用熟悉的 Web 技术来构建精美的用户界面，
学习如何在 Lynx 引擎中描绘界面。

- [内置元件](/next/zh/guide/ui/elements-components): 了解 Lynx 提供的内置元件

- [样式](/next/zh/guide/ui/styling): 了解如何在 Lynx 中应用不同的样式





- [布局](/next/zh/guide/ui/layout): 布局你的元件和组件

- [滚动](/next/zh/guide/ui/scrolling): 了解如何在 Lynx 中使用可滚动元件

