Skip to content

Commit 0b1d3d2

Browse files
committed
Fix demo event handlers
1 parent d8aab07 commit 0b1d3d2

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

demo/src/index.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,34 @@ const PATTERNS = [
99
'1111 1111',
1010
'111 111',
1111
'11 11',
12-
'1 1'
12+
'1 1',
1313
]
1414

1515
class App extends React.Component {
16-
constructor(props) {
17-
super(props)
18-
19-
this.state = {
20-
card: '',
21-
expiry: '',
22-
ccv: '',
23-
plate: '',
24-
escaped: '',
25-
leading: '',
26-
custom: '',
27-
changing: '',
28-
pattern: '1111 1111',
29-
cardPattern: '1111 1111 1111 1111'
30-
}
16+
state = {
17+
card: '',
18+
expiry: '',
19+
ccv: '',
20+
plate: '',
21+
escaped: '',
22+
leading: '',
23+
custom: '',
24+
changing: '',
25+
pattern: '1111 1111',
26+
cardPattern: '1111 1111 1111 1111',
3127
}
3228

33-
_onChange(e) {
29+
_onChange = (e) => {
3430
const stateChange = {}
3531
stateChange[e.target.name] = e.target.value
3632
this.setState(stateChange)
3733
}
3834

39-
_changePattern(e) {
35+
_changePattern = (e) => {
4036
this.setState({pattern: e.target.value})
4137
}
4238

43-
_onCardChange(e) {
39+
_onCardChange = (e) => {
4440
if (/^3[47]/.test(e.target.value)) {
4541
this.setState({cardPattern: '1111 111111 11111'})
4642
}

0 commit comments

Comments
 (0)