MCPcopy
hub / github.com/webiny/webiny-js / useIdGenerator

Function useIdGenerator

packages/react-properties/src/useIdGenerator.ts:6–18  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

4const keywords = ["$first", "$last"];
5
6export function useIdGenerator(name: string) {
7 const parentProperty = useParentProperty();
8
9 return useCallback(
10 (...parts: string[]) => {
11 if (keywords.includes(parts[0])) {
12 return parts[0];
13 }
14 return [parentProperty?.id, name, ...parts].filter(Boolean).join(":");
15 },
16 [name, parentProperty]
17 );
18}

Callers 15

Filter.tsxFile · 0.90
FilterFunction · 0.90
SidebarFooterFunction · 0.90
BulkAction.tsxFile · 0.90
Filter.tsxFile · 0.90
BaseBulkActionFunction · 0.90
Filter.tsxFile · 0.90
Element.tsxFile · 0.90
RendererFunction · 0.90
BaseBulkActionFunction · 0.90
KeyValuesFunction · 0.90
ExtensionReactComponentFunction · 0.90

Calls 3

useParentPropertyFunction · 0.85
filterMethod · 0.65
joinMethod · 0.45

Tested by 1

FilterFunction · 0.72