MCPcopy Index your code
hub / github.com/react/react / makeId

Function makeId

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:1091–1108  ·  view source on GitHub ↗
(
  resumableState: ResumableState,
  treeId: string,
  localId: number,
)

Source from the content-addressed store, hash-verified

1089}
1090
1091export function makeId(
1092 resumableState: ResumableState,
1093 treeId: string,
1094 localId: number,
1095): string {
1096 const idPrefix = resumableState.idPrefix;
1097
1098 let id = '_' + idPrefix + 'R_' + treeId;
1099
1100 // Unless this is the first id at this level, append a number at the end
1101 // that represents the position of this useId hook among all the useId
1102 // hooks for this fiber.
1103 if (localId > 0) {
1104 id += 'H' + localId.toString(32);
1105 }
1106
1107 return id + '_';
1108}
1109
1110function encodeHTMLTextNode(text: string): string {
1111 return escapeTextForBrowser(text);

Callers 2

useIdFunction · 0.90
getViewTransitionNameFunction · 0.90

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected