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

Function initWrapperState

code/composition/public/app.js:4622–4644  ·  view source on GitHub ↗
(element, props)

Source from the content-addressed store, hash-verified

4620}
4621
4622function initWrapperState(element, props) {
4623 {
4624 ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum);
4625
4626 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
4627 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);
4628 didWarnCheckedDefaultChecked = true;
4629 }
4630 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
4631 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);
4632 didWarnValueDefaultValue = true;
4633 }
4634 }
4635
4636 var node = element;
4637 var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
4638
4639 node._wrapperState = {
4640 initialChecked: props.checked != null ? props.checked : props.defaultChecked,
4641 initialValue: getSafeValue(props.value != null ? props.value : defaultValue),
4642 controlled: isControlled(props)
4643 };
4644}
4645
4646function updateChecked(element, props) {
4647 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