@@ -7,59 +7,70 @@ A `bind` call or [arrow function](https://developer.mozilla.org/en-US/docs/Web/J
77The following patterns are considered warnings:
88
99``` jsx
10- < div onClick= {this ._handleClick .bind (this )}>< / div >
10+ < Foo onClick= {this ._handleClick .bind (this )}>< / Foo >
1111```
1212``` jsx
13- < div onClick= {() => console .log (' Hello!' )}>< / div >
13+ < Foo onClick= {() => console .log (' Hello!' )}>< / Foo >
1414```
1515
1616The following patterns are ** not** considered warnings:
1717``` jsx
18- < div onClick= {this ._handleClick }>< / div >
18+ < Foo onClick= {this ._handleClick }>< / Foo >
1919```
2020
2121## Rule Options
2222
2323``` js
2424" react/jsx-no-bind" : [< enabled> , {
25+ " ignoreDOMComponents" : < boolean> || false ,
2526 " ignoreRefs" : < boolean> || false ,
2627 " allowArrowFunctions" : < boolean> || false ,
2728 " allowFunctions" : < boolean> || false ,
2829 " allowBind" : < boolean> || false
2930}]
3031```
3132
33+ ### ` ignoreDOMComponents `
34+
35+ When ` true ` the following are ** not** considered warnings:
36+
37+ ``` jsx
38+ < div onClick= {this ._handleClick .bind (this ) / >
39+ < span onClick= {() => console .log (" Hello!" )} / >
40+ < button onClick= {function () { alert (" 1337" ) }} / >
41+ ` ` `
42+
3243### ` ignoreRefs`
3344
3445When ` true ` the following are **not** considered warnings:
3546
3647` ` ` jsx
37- < div ref= {c => this ._div = c} / >
38- < div ref= {this ._refCallback .bind (this )} / >
48+ < Foo ref= {c => this ._div = c} / >
49+ < Foo ref= {this ._refCallback .bind (this )} / >
3950` ` `
4051
4152### ` allowArrowFunctions`
4253
4354When ` true ` the following is **not** considered a warning:
4455
4556` ` ` jsx
46- < div onClick= {() => alert (" 1337" )} / >
57+ < Foo onClick= {() => alert (" 1337" )} / >
4758` ` `
4859
4960### ` allowFunctions`
5061
5162When ` true ` the following is not considered a warning:
5263
5364` ` ` jsx
54- < div onClick= {function () { alert (" 1337" ) }} / >
65+ < Foo onClick= {function () { alert (" 1337" ) }} / >
5566` ` `
5667
5768### ` allowBind`
5869
5970When ` true ` the following is **not** considered a warning:
6071
6172` ` ` jsx
62- < div onClick= {this ._handleClick .bind (this )} / >
73+ < Foo onClick= {this ._handleClick .bind (this )} / >
6374` ` `
6475
6576## Protips
0 commit comments