effex-monorepo
    Preparing search index...

    Type Alias Element<N, E, R>

    Element: Effect.Effect<N, E, Scope.Scope | RendererContext | R>

    A rendered element wrapped in an Effect with scope management. This is the generic version that works with any renderer.

    Type Parameters

    • N = unknown

      The node type (e.g., HTMLElement for DOM, string for SSR)

    • E = never

      The error type (defaults to never for infallible elements)

    • R = never

      Additional requirements/context type beyond RendererContext

    // DOM element (using @effex/dom)
    const myButton: Element<HTMLButtonElement> = button({ class: "primary" }, $.of("Click me"))

    // Function that can fail
    const UserProfile = () =>
    Effect.gen(function* () {
    const user = yield* fetchUser(userId)
    return yield* div({}, $.of(user.name))
    })

    // Function with context requirements
    const NavLink = () =>
    Effect.gen(function* () {
    const router = yield* RouterContext
    return yield* button({ onClick: () => router.push("/") }, $.of("Home"))
    })