@joint/react
    Preparing search index...

    Function useLinks

    • A hook to access the graph store's links.

      This hook returns the selected links from the graph store. It accepts:

      • a selector function, which extracts the desired portion from the links map. (By default, it returns all links.)
      • an optional isEqual function, used to compare previous and new values to prevent unnecessary re-renders.

      How it works:

      1. The hook subscribes to the links of the graph store.
      2. It retrieves the links and then applies the selector.
      3. The isEqual comparator (defaulting to a deep comparison) checks if the selected value has really changed.

      Type Parameters

      Parameters

      Returns SelectorReturnType

      • The selected links.
      // Using without a selector (returns all links):
      const links = useLinks();
      // Using with a selector (extract part of the links data):
      const linkIds = useLinks((links) => links.map(link => link.id));

      // Using with a custom isEqual function:

      const filteredLinks = useLinks(
      (links) => links,
      (prev, next) => prev.length === next.length
      );