function / @typed/ui/index

Tree.makeState

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

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Hierarchy state
Since
1.0.0
Member of
Tree

Import

import { Tree } from "@typed/ui/index";

Access Tree.makeState through the imported Tree export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

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

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 };
  }),
);

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source