flâneur

What is ‘this’ in React?. And why do we use it all the time? | by Trey Alexander Davis | Byte-sized React | Medium

medium.com · 729 words · saved by 1 readers

And why do we use it all the time?

4 min read Nov 30, 2017 -- And why do we use it all the time? If you are jumping into React, you are probably seeing a lot of ‘this’ lately. Let’s dive into what the ‘this’ keyword means in JavaScript and React. The ‘this’ keyword The ‘this’ keyword typically references a JavaScript element depending on the scope or context of its use. Let me give you a few examples for that to set in. Global ‘this’ scope The most straight forward scope is the global scope in your browser. If you open the console in a web browser and run the following… this The browser will return the global Window…

related reading