Home / Function/ track() — react Function Reference

track() — react Function Reference

Architecture documentation for the track() function in inputValueTracking.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  49843596_bcbe_c41c_e960_1ffc711ed1ed["track()"]
  87cb1bb7_ad8f_2954_9806_14348a9bbec3["inputValueTracking.js"]
  49843596_bcbe_c41c_e960_1ffc711ed1ed -->|defined in| 87cb1bb7_ad8f_2954_9806_14348a9bbec3
  754de9fa_432c_542e_fa21_08b18b75915b["initInput()"]
  754de9fa_432c_542e_fa21_08b18b75915b -->|calls| 49843596_bcbe_c41c_e960_1ffc711ed1ed
  d7552454_ad8c_6921_661d_7d0abf4e6add["initTextarea()"]
  d7552454_ad8c_6921_661d_7d0abf4e6add -->|calls| 49843596_bcbe_c41c_e960_1ffc711ed1ed
  style 49843596_bcbe_c41c_e960_1ffc711ed1ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/inputValueTracking.js lines 119–130

export function track(node: ElementWithValueTracker) {
  if (getTracker(node)) {
    return;
  }

  const valueField = isCheckable(node) ? 'checked' : 'value';
  // This is read from the DOM so always safe to coerce. We really shouldn't
  // be coercing to a string at all. It's just historical.
  // eslint-disable-next-line react-internal/safe-string-coercion
  const initialValue = '' + (node[valueField]: any);
  node._valueTracker = trackValueOnNode(node, valueField, initialValue);
}

Domain

Subdomains

Frequently Asked Questions

What does track() do?
track() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/inputValueTracking.js.
Where is track() defined?
track() is defined in packages/react-dom-bindings/src/client/inputValueTracking.js at line 119.
What calls track()?
track() is called by 2 function(s): initInput, initTextarea.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free