File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,7 @@ function tellMeWhenDone(callback){
15
15
16
16
tellMeWhenDone ( function ( ) { console . log ( "I am Done" ) } )
17
17
18
- tellMeWhenDone ( function ( ) { alert ( "I am Done" ) } )
18
+ tellMeWhenDone ( function ( ) { alert ( "I am Done" ) } )
19
+
20
+
21
+ // Have a look a currying.js
Original file line number Diff line number Diff line change
1
+ // <input onClick={ this.handleClick({ anyValue }) } />
2
+ "use strict"
3
+
4
+ let handleClick = ( { name } ) => ( e ) => {
5
+ console . log ( name ) // index or id I may want to assign value to
6
+ console . log ( this ) // the value of the input field
7
+ }
8
+
9
+ let a = handleClick ( { name : 'Ashfaq' } ) ;
10
+ let b = handleClick ( { name : 'Ansari' } ) ;
11
+
12
+ console . log ( a . name )
13
+ console . log ( a === b )
14
+
15
+ // In debug check the scope 3 {closure will be different}
16
+ // reference to name will be different.
17
+ // https://hackernoon.com/curry-away-in-react-7c4ed110c65a
18
+ // https://medium.freecodecamp.org/this-is-why-we-need-to-bind-event-handlers-in-class-components-in-react-f7ea1a6f93eb
You can’t perform that action at this time.
0 commit comments