Skip to content

Commit 0198e20

Browse files
committed
Define input state in constructor
1 parent 259b63a commit 0198e20

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

components/dash-core-components/src/components/Input.react.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export default class Input extends PureComponent {
2020
constructor(props) {
2121
super(props);
2222

23+
this.state = {
24+
pendingEvent: undefined,
25+
value: '',
26+
};
27+
2328
this.input = React.createRef();
2429

2530
this.onBlur = this.onBlur.bind(this);
@@ -33,7 +38,7 @@ export default class Input extends PureComponent {
3338

3439
UNSAFE_componentWillReceiveProps(nextProps) {
3540
const {value} = this.input.current;
36-
if (this.state?.pendingEvent) {
41+
if (this.state.pendingEvent) {
3742
// avoid updating the input while awaiting a debounced event
3843
return;
3944
}

0 commit comments

Comments
 (0)