Skip to content

Commit 63b229e

Browse files
authored
Merge pull request #94 from rkrupinski/master
Tweaked the paragraph on arrow functions a bit.
2 parents a3f5b96 + 91add11 commit 63b229e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

patterns/22.event-handlers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class Switcher extends React.Component {
7070
}
7171
```
7272

73-
The other alternative is to use arrow functions for the onClick prop function assignment,
74-
Arrow functions auto binds the function with `this`.
73+
The other alternative is to use arrow functions for the onClick prop function assignment.
74+
Arrow functions don't affect the context at invocation time (`this` value from the surrounding scope is used).
7575

7676
Facebook by the way recommend the same technique while dealing with functions that need the context of the same component.
7777
The binding in the constructor may be also useful if we pass callbacks down the tree.
@@ -93,4 +93,4 @@ class Switcher extends React.Component {
9393
console.log(`Button is clicked inside ${ this.state.name }`);
9494
}
9595
}
96-
```
96+
```

0 commit comments

Comments
 (0)