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

Function setDefaultValue

packages/react-dom-bindings/src/client/ReactDOMInput.js:472–486  ·  view source on GitHub ↗
(
  node: HTMLInputElement,
  type: ?string,
  value: ToStringValue,
)

Source from the content-addressed store, hash-verified

470//
471// https://github.com/facebook/react/issues/7253
472export function setDefaultValue(
473 node: HTMLInputElement,
474 type: ?string,
475 value: ToStringValue,
476) {
477 if (
478 // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
479 type !== 'number' ||
480 getActiveElement(node.ownerDocument) !== node
481 ) {
482 if (node.defaultValue !== toString(value)) {
483 node.defaultValue = toString(value);
484 }
485 }
486}

Callers 2

updateInputFunction · 0.85

Calls 2

toStringFunction · 0.90
getActiveElementFunction · 0.85

Tested by

no test coverage detected