# @webflow/react

## 2.2.0

### Minor Changes

- 216c13d: Preparatory internal changes.

### Patch Changes

- Updated dependencies [216c13d]
  - @webflow/data-types@2.2.0
  - @webflow/functions@2.2.0

## 2.1.1

### Patch Changes

- b516d34: Fix a crash ("Element type is invalid... but got: object") when a page has multiple code components built against different React versions.
  - @webflow/data-types@2.1.1

## 2.1.0

### Minor Changes

- 47c25e3: Add prerender data hydration for Code Components.

  - **`useSuspenseData(key, loader)`** — Suspense-friendly hook that owns the fetch: runs the loader during prerender, records the result, and replays it synchronously on hydrate (no refetch, no first-paint loading flash). Returns `{ data }`. For components that fetch their own data.
  - **`usePrerenderData<T>(key)`** — read-only seed for components whose fetching is owned by a Suspense-capable library (React Query `useSuspenseQuery`, SWR `{ suspense: true }`). Returns `{ data }` — the prerendered data (or `undefined`). Seed the library via `initialData` / `fallbackData`.
  - **`useHydrateData(key, value)`** — companion hook that records a library-fetched value into the prerender snapshot during render. Takes the **same `key`** you passed to `usePrerenderData` and your data library and accepts `T | undefined` (a no-op), so libraries whose `data` stays `T | undefined` (e.g. SWR) need no cast. Being a hook, the rules of hooks keep it out of effects/conditionals.
  - **Keys** are a stable identity: either a plain string (used as-is — handy for a URL + query string) or an array of `string` / `number` / `boolean` segments joined with `:` (e.g. `["todo", id]` → `"todo:id"` in collected data). **First-write-wins** on collision (for both `useSuspenseData` auto-record and `useHydrateData`). Values must be JSON-serializable; not a general client cache (no invalidation/refetch).
  - **`PrerenderDataProvider`** — context for collect (server) vs seeded (client) modes. Exported from `@webflow/react`, `@webflow/react/server`, and the new **`@webflow/react/shared`** subpath (for library bundles that need a single context instance).
  - **`ComponentRuntimeOptions.data`** — optional prerender data map passed to **`ClientRenderer.hydrate`** / **`render`**.
  - **`ServerPrerenderResult.data`** — optional JSON map returned from **`ServerRenderer.prerenderToString`** (and Emotion/styled-components server renderers) when `useSuspenseData` / `useHydrateData` collect entries.
  - Host **`SuspenseBoundary`** wraps code components so the hooks work without a customer `<Suspense>`; use **`ssr: 'prerender'`** so data resolves before first paint.

### Patch Changes

- @webflow/data-types@2.1.0

## 2.0.0

### Major Changes

- 48a5900: - Added `@webflow/react/server` subpath export (use `import … from "@webflow/react/server"`) and moved server-only API `ServerRenderer` into it.
  - `ServerRenderer` now includes `prerenderToString`: render HTML async after Suspense boundaries resolve.
  - `ServerRenderer.renderToString` return type changed to `string | {html: string; styles?: string}` to align with `ComponentServerRendererFactory`

### Minor Changes

- 10896e6: Raise `react`/`react-dom` peer dependency support to all `19.x` minor versions (previous support was until version `19.0.0`)

### Patch Changes

- Updated dependencies [14c2ebc]
  - @webflow/data-types@2.0.0

## 1.3.0

### Patch Changes

- Updated dependencies [ddda3b7]
  - @webflow/data-types@1.3.0

## 1.2.2

### Patch Changes

- Use caret ranges for @webflow dependencies to allow patch/minor updates
- Updated dependencies
  - @webflow/data-types@1.2.2

## 1.2.1

### Patch Changes

- Updated dependencies [dbf223b]
  - @webflow/data-types@1.2.1

## 1.2.0

### Minor Changes

- Add support for custom renderers in code component libraries

### Patch Changes

- Updated dependencies
  - @webflow/data-types@1.2.0

## 1.1.0

### Minor Changes

- Added support for Code Components Decorators

### Patch Changes

- Updated dependencies
  - @webflow/data-types@1.1.0

## 1.0.4

### Patch Changes

- Fix version mismatch
- Updated dependencies
  - @webflow/data-types@1.0.4

## 1.0.3

### Patch Changes

- Updated dependencies
  - @webflow/data-types@1.0.3

## 1.0.2

### Patch Changes

- Updated code components SSR bundle manifest to fix a bug with styles not being server-side rendered correctly
- Updated dependencies
  - @webflow/data-types@1.0.2

## 1.0.1

### Patch Changes

- Updated dependencies
  - @webflow/data-types@1.0.1

## 1.0.0

### Major Changes

- Stable release
- Updated dependencies
  - @webflow/data-types@1.0.0

### Patch Changes

- Updated dependencies
  - @webflow/data-types@1.0.0

## 0.0.12

### Patch Changes

- Added tooltip support
- Updated dependencies
  - @webflow/data-types@0.0.12

## 0.0.11

### Patch Changes

- Fix ssr bundle config and improve js docs
- Updated dependencies
  - @webflow/data-types@0.0.11

## 0.0.10

### Patch Changes

- New prop support
- Updated dependencies
  - @webflow/data-types@0.0.10

## 0.0.9

### Patch Changes

- Enable code component ssr option
- Updated dependencies
  - @webflow/data-types@0.0.9

## 0.0.8

### Patch Changes

- New declaration options
- Updated dependencies
  - @webflow/data-types@0.0.8

## 0.0.7

### Patch Changes

- Added support for Number prop settings and better JSDocs
- Updated dependencies
  - @webflow/data-types@0.0.7

## 0.0.6

### Patch Changes

- Updated dependencies
  - @webflow/data-types@0.0.6

## 0.0.5

### Patch Changes

- Minor fixes
- Updated dependencies
  - @webflow/data-types@0.0.5

## 0.0.4

### Patch Changes

- Minor fixes
- Updated dependencies
  - @webflow/data-types@0.0.4

## 0.0.3

### Patch Changes

- Updated dependencies
  - @webflow/data-types@0.0.3

## 0.0.2

### Patch Changes

- Fix dependencies
- Updated dependencies
  - @webflow/data-types@0.0.2

## 0.0.1

### Patch Changes

- Initial release
- Updated dependencies
  - @webflow/data-types@0.0.1
