ControlledInputs Class — react Architecture
Architecture documentation for the ControlledInputs class in ReactDOMInput-test.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD eee21e17_a72b_5d13_0350_2770b115bcf7["ControlledInputs"] 118068ac_749f_d3e1_1997_e450bfcca8e4["ReactDOMInput-test.js"] eee21e17_a72b_5d13_0350_2770b115bcf7 -->|defined in| 118068ac_749f_d3e1_1997_e450bfcca8e4 1263c767_0b90_1870_deeb_cae31a48a63e["change()"] eee21e17_a72b_5d13_0350_2770b115bcf7 -->|method| 1263c767_0b90_1870_deeb_cae31a48a63e c43fe588_8b65_feb5_7aa2_daa5282e73b9["blur()"] eee21e17_a72b_5d13_0350_2770b115bcf7 -->|method| c43fe588_8b65_feb5_7aa2_daa5282e73b9 e615e3bb_b80b_83af_46e2_3f666f89a1eb["render()"] eee21e17_a72b_5d13_0350_2770b115bcf7 -->|method| e615e3bb_b80b_83af_46e2_3f666f89a1eb
Relationship Graph
Source Code
packages/react-dom/src/__tests__/ReactDOMInput-test.js lines 246–279
class ControlledInputs extends React.Component {
state = {value: 'lion'};
a = null;
b = null;
switchedFocus = false;
change(newValue) {
this.setState({value: newValue});
// Calling focus here will blur the text box which causes a native
// change event. Ideally we shouldn't have to fire this ourselves.
// Don't remove unless you've verified the fix in #8240 is still covered.
dispatchEventOnNode(this.a, 'input');
this.b.focus();
}
blur(currentValue) {
this.switchedFocus = true;
// currentValue should be 'giraffe' here because we should not have
// restored it on the target yet.
this.setState({value: currentValue});
}
render() {
return (
<div>
<input
type="text"
ref={n => (this.a = n)}
value={this.state.value}
onChange={e => this.change(e.target.value)}
onBlur={e => this.blur(e.target.value)}
/>
<input type="text" ref={n => (this.b = n)} />
</div>
);
}
}
Source
Frequently Asked Questions
What is the ControlledInputs class?
ControlledInputs is a class in the react codebase, defined in packages/react-dom/src/__tests__/ReactDOMInput-test.js.
Where is ControlledInputs defined?
ControlledInputs is defined in packages/react-dom/src/__tests__/ReactDOMInput-test.js at line 246.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free