Skip to content

Commit 4f375c9

Browse files
committed
🐛 Demo: Add numInputs error condition
1 parent 998db01 commit 4f375c9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/demo/index.jsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ class Demo extends Component {
2525
};
2626

2727
handleChange = e => {
28-
const { minLength, maxLength } = this.state;
2928
let currVal = e.target.value;
3029

31-
if (currVal < minLength || currVal > maxLength) {
32-
currVal = 4;
30+
if (e.target.name === 'numInputs') {
31+
const { minLength, maxLength } = this.state;
3332

34-
console.error(
35-
`Please enter a value between ${minLength} and ${maxLength}`
36-
);
33+
if (currVal < minLength || currVal > maxLength) {
34+
currVal = 4;
35+
36+
console.error(
37+
`Please enter a value between ${minLength} and ${maxLength}`
38+
);
39+
}
3740
}
3841

3942
this.setState({ [e.target.name]: currVal });

0 commit comments

Comments
 (0)