# 入门指南 · 安装

安装 Edge 并在 React 中开始使用。

Package: @bolerish/edge 0.4.0
Source: https://edge.bolerish.com/zh/docs/installation/

<a id="installation"></a>

## 安装

React 适配器需要 React 18 或 19。其他框架的适配器暂未提供。

npm

```bash
npm install @bolerish/edge
```

pnpm

```bash
pnpm add @bolerish/edge
```

Yarn

```bash
yarn add @bolerish/edge
```

Bun

```bash
bun add @bolerish/edge
```

<a id="stylesheet"></a>

## 默认样式

React 会在连接表面时自动准备默认 CSS，即使仅使用 Hook 而不使用 Edge.Provider 也是如此，无需导入样式表。使用 SSR 时，请在应用样式之前为每个文档渲染一次 Edge.Styles。如果 CSP 要求 nonce，请在服务端和水合时使用同一请求的 nonce。

```tsx
<Edge.Styles nonce={nonce} />
```

```css
@import "@bolerish/edge/style.css";
```

现有的 CSS 导入方式仍然可用，也提供不依赖框架的 CSS 文件。显式导入时，请将其放在应用和工具类样式之前；重置样式可以更早加载。 通过包路径导入 CSS 时，需要能解析该路径的构建工具。

<a id="next-steps"></a>

## 开始使用 Edge

在[用法](https://edge.bolerish.com/zh/docs/usage/)中确定共享光照的区域和 表面，再按照[React](https://edge.bolerish.com/zh/docs/react/usage/)连接。
