A hook to access the graph store's links.
This hook returns the selected links from the graph store. It accepts:
isEqual
How it works:
A function to select a portion of the links.
A function to compare the previous and new values.
// Using without a selector (returns all links):const links = useLinks(); Copy
// 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)); Copy
// 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); Copy
const filteredLinks = useLinks( (links) => links, (prev, next) => prev.length === next.length);
A hook to access the graph store's links.
This hook returns the selected links from the graph store. It accepts:
isEqual
function, used to compare previous and new values to prevent unnecessary re-renders.How it works:
isEqual
comparator (defaulting to a deep comparison) checks if the selected value has really changed.