Can you bind 'this' in an arrow function ?

 Bind 'this' in arrow function Javascript

'This' keywork in arrow function Javascript

Rebind 'this' in arrow function

Context of arrow function

Cannot bind 'this' in arrow function


You cannot rebind this in an arrow function. It will always be defined as the context in which it was defined. If you require this to be meaningful you should use a normal function.

 

Differences & Limitations of Arrow function vs Normal function:

Can you bind 'this' in an arrow function, context of arrow function


Reference: 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
https://stackoverflow.com/questions/33308121/can-you-bind-this-in-an-arrow-function

Nhận xét

Bài đăng phổ biến từ blog này

TypeORM should using repository or query buider ?

Type of children prop in React Typescript

Why we should Avoid using UNSAFE componentWillMount, componentWillReceiveProps, componentWillUpdate