This hook returns the selected elements from the graph store. It accepts:
a selector function, which extracts the desired portion from the elements map.
an optional isEqual function, used to compare previous and new values—ensuring
the component only re-renders when necessary.
How it works:
The hook subscribes to the elements of the graph store.
It fetches the elements from the store and then applies the selector.
To avoid unnecessary re-renders (especially since the selector could produce new
references on each call), the isEqual comparator (defaulting to a deep comparison)
checks if the selected value really changed.
A hook to access
dia.graph
elementsThis hook returns the selected elements from the graph store. It accepts:
isEqual
function, used to compare previous and new values—ensuring the component only re-renders when necessary.How it works:
isEqual
comparator (defaulting to a deep comparison) checks if the selected value really changed.