@mocanvas/editor · function

useUniqueSafeId

declare function useUniqueSafeId(suffix?: string): SafeId

An id unique to this component instance, safe for url(#…).

Two mounts of the same component get different ids, which is what a per-instance <defs> entry needs — otherwise the second mount's gradient overwrites the first's.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.