MCPcopy
hub / github.com/facebook/react / track

Function track

packages/react-dom-bindings/src/client/inputValueTracking.js:119–130  ·  view source on GitHub ↗
(node: ElementWithValueTracker)

Source from the content-addressed store, hash-verified

117}
118
119export function track(node: ElementWithValueTracker) {
120 if (getTracker(node)) {
121 return;
122 }
123
124 const valueField = isCheckable(node) ? 'checked' : 'value';
125 // This is read from the DOM so always safe to coerce. We really shouldn't
126 // be coercing to a string at all. It's just historical.
127 // eslint-disable-next-line react-internal/safe-string-coercion
128 const initialValue = '' + (node[valueField]: any);
129 node._valueTracker = trackValueOnNode(node, valueField, initialValue);
130}
131
132export function trackHydrated(
133 node: ElementWithValueTracker,

Callers 2

initTextareaFunction · 0.90
initInputFunction · 0.90

Calls 3

getTrackerFunction · 0.85
isCheckableFunction · 0.85
trackValueOnNodeFunction · 0.85

Tested by

no test coverage detected