• Subscribe to a single graph node.

    Type Parameters

    • T

      Value type of the observed node.

    Parameters

    • node: Node<T>

      The input or derived node to subscribe to. The component re-renders only when this node's value changes — unrelated commits do not trigger a re-render.

    Returns T

    The node's current committed value.

    Error when called outside <CauslProvider>.

    Backed by useSyncExternalStore for concurrent-render safety. The subscription is via graph.subscribe(node, cb), which the engine fires exactly once per commit during which the node's value changed (with the engine's own Object.is equality cutoff applied). This is more efficient than the selector-based useCausl for components that read a single node because React's onChange is never invoked for commits that do not touch the subscribed node.

    For multi-node projections, use useCausl with a selector.

    const total = useCauslNode(totalNode)