MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / initWrapperState

Function initWrapperState

code/one-direction-data-flow/public/app.js:4357–4379  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

4355}
4356
4357function initWrapperState(element, props) {
4358 {
4359 ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum);
4360
4361 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
4362 warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName() || 'A component', props.type);
4363 didWarnCheckedDefaultChecked = true;
4364 }
4365 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
4366 warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName() || 'A component', props.type);
4367 didWarnValueDefaultValue = true;
4368 }
4369 }
4370
4371 var node = element;
4372 var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
4373
4374 node._wrapperState = {
4375 initialChecked: props.checked != null ? props.checked : props.defaultChecked,
4376 initialValue: getSafeValue(props.value != null ? props.value : defaultValue),
4377 controlled: isControlled(props)
4378 };
4379}
4380
4381function updateChecked(element, props) {
4382 var node = element;

Callers 2

setInitialProperties$1Function · 0.70
diffHydratedProperties$1Function · 0.70

Calls 3

warningFunction · 0.85
getSafeValueFunction · 0.70
isControlledFunction · 0.70

Tested by

no test coverage detected