@logixjs/react
    Preparing search index...

    Type Alias ModuleScope<Ref>

    type ModuleScope<Ref> = {
        Bridge: React.FC<{ children: React.ReactNode; scopeId: string }>;
        Context: React.Context<Ref | null>;
        Provider: React.FC<
            { children: React.ReactNode; options?: ModuleScopeOptions },
        >;
        use: () => Ref;
        useImported: <Id extends string, Sh extends Logix.AnyModuleShape>(
            module: Logix.ModuleTagType<Id, Sh>,
        ) => ModuleRef<
            Logix.StateOf<Sh>,
            Logix.ActionOf<Sh>,
            keyof Sh["actionMap"] & string,
            Logix.ModuleTagType<Id, Sh>,
            ModuleDispatchersOfShape<Sh>,
        >;
    }

    Type Parameters

    • Ref
    Index

    Properties

    Bridge: React.FC<{ children: React.ReactNode; scopeId: string }>

    Bridge: reuse the same scope across React subtrees / separate roots.

    • Precondition: within the same runtime tree, some Provider (typically a route/page boundary) has already registered the scope with a stable scopeId.
    • Behavior: retrieves the registered runtime + module runtime from ScopeRegistry and re-provides them in this subtree.
    Context: React.Context<Ref | null>
    Provider: React.FC<{ children: React.ReactNode; options?: ModuleScopeOptions }>
    use: () => Ref
    useImported: <Id extends string, Sh extends Logix.AnyModuleShape>(
        module: Logix.ModuleTagType<Id, Sh>,
    ) => ModuleRef<
        Logix.StateOf<Sh>,
        Logix.ActionOf<Sh>,
        keyof Sh["actionMap"] & string,
        Logix.ModuleTagType<Id, Sh>,
        ModuleDispatchersOfShape<Sh>,
    >

    useImported: sugar for the route Host(imports) use case.

    Equivalent to:

    • const host = scope.use()
    • const child = host.imports.get(Child.tag)