# makeState

Creates hydrated Tree state. activeId defaults null and expandedIds defaults empty.

## Signatures

```ts
export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
    readonly activeId: string | null;
    readonly expandedIds: readonly string[];
    readonly loop: boolean;
}, Schema.SchemaError, never, never>, never, Scope.Scope>;
```



## Examples

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

const program = Effect.scoped(
  Effect.gen(function* () {
    const state = yield* Tree.makeState({});
    const collection = yield* Tree.makeCollection();
    return { state: yield* state, collection: yield* collection };
  }),
);
```
