MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / updateWrapper$1

Function updateWrapper$1

code/new-context-api/public/app.js:14080–14099  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

14078}
14079
14080function updateWrapper$1(element, props) {
14081 var node = element;
14082 var value = props.value;
14083 if (value != null) {
14084 // Cast `value` to a string to ensure the value is set correctly. While
14085 // browsers typically do this as necessary, jsdom doesn't.
14086 var newValue = '' + value;
14087
14088 // To avoid side effects (such as losing text selection), only set value if changed
14089 if (newValue !== node.value) {
14090 node.value = newValue;
14091 }
14092 if (props.defaultValue == null) {
14093 node.defaultValue = newValue;
14094 }
14095 }
14096 if (props.defaultValue != null) {
14097 node.defaultValue = props.defaultValue;
14098 }
14099}
14100
14101function postMountWrapper$3(element, props) {
14102 var node = element;

Callers 2

restoreControlledState$3Function · 0.70
updateProperties$1Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected