# makeState

Creates hydrated Collection state. The collection starts with the supplied immutable item array,
or empty.

## Signatures

```ts
export declare function makeState<Value = unknown, Element extends object = globalThis.Element>(initial?: State<Value, Element>): Effect.Effect<RefSubject.RefSubject<State<Value, Element>>, never, Scope.Scope>;
```

## Why

State and collection ownership can be composed and tested independently from any renderer.

## Ownership and lifetime

The returned Effect creates the RefSubject when run. That state is renderer-independent;
collection registrations belong to the separate Scope that runs register or ref, not to state
creation.

## Examples

```ts
import * as Effect from "effect/Effect";
import * as Collection from "@typed/ui/Collection";

const program = Effect.scoped(
  Effect.gen(function* () {
    const collection = yield* Collection.makeState<string>();
    return yield* collection;
  }),
);
```
