Skip to content

Commit f2260f3

Browse files
donysukardilozjackson
authored andcommitted
Refactor ref as Component's instance function (#808)
1 parent 55edd7a commit f2260f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

react/src/reactTextMask.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ export default class MaskedInput extends React.PureComponent {
88
constructor(...args) {
99
super(...args)
1010

11+
this.setRef = this.setRef.bind(this)
1112
this.onBlur = this.onBlur.bind(this)
1213
this.onChange = this.onChange.bind(this)
1314
}
1415

16+
setRef(inputElement) {
17+
this.inputElement = inputElement
18+
}
19+
1520
initTextMask() {
1621
const {props, props: {value}} = this
1722

@@ -66,9 +71,7 @@ export default class MaskedInput extends React.PureComponent {
6671
delete props.onChange
6772
delete props.showMask
6873

69-
const ref = (inputElement) => (this.inputElement = inputElement)
70-
71-
return render(ref, {
74+
return render(this.setRef, {
7275
onBlur: this.onBlur,
7376
onChange: this.onChange,
7477
defaultValue: this.props.value,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy