MCPcopy Create free account
hub / github.com/Lobos/react-ui / componentWillReceiveProps

Method componentWillReceiveProps

src/higherOrders/FormItem.js:49–72  ·  view source on GitHub ↗
(nextProps)

Source from the content-addressed store, hash-verified

47 }
48
49 componentWillReceiveProps (nextProps) {
50 let { name, value, formData, itemUnbind } = nextProps;
51
52 if (nextProps.type && nextProps.type !== this.props.type) {
53 this.valueType = getValueType(nextProps.type);
54 }
55
56 if (formData) {
57 value = formData[name];
58
59 if (this.props.name !== name && itemUnbind) {
60 itemUnbind(this.id, this.props.name);
61 this.bindToForm(nextProps, value);
62 }
63
64 if (value !== this.state.value) {
65 this.handleChange(value, nextProps);
66 }
67 } else {
68 if (value !== this.props.value && value !== this.state.value) {
69 this.handleChange(value, nextProps);
70 }
71 }
72 }
73
74 shouldComponentUpdate (nextProps, nextState) {
75 return !shallowEqual(nextProps, this.props) || !shallowEqual(this.state, nextState);

Callers

nothing calls this directly

Calls 3

bindToFormMethod · 0.95
handleChangeMethod · 0.95
getValueTypeFunction · 0.85

Tested by

no test coverage detected