Are 'this' keyword still used in react.js now? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Are 'this' keyword still used in react.js now?

I often see old video tutorial about 2 or 3 years ago, that often used 'this' keyword but new tutorial video like 1 years ago until now not so much used 'this' keyword or even doesn't used it at all. My equation is, are 'this' keyword stiil in used these day? Note: and I don't know 'this' keyword are used for what in both javascript or react

1st Jan 2022, 1:32 PM
EsaKurniawan
1 Answer
+ 6
The concept of "this" is not related to react.js but rather to JavaScript My guess is that you encounter less and less "this" usage in react is due to the introduction of Hooks in version 16.8 of react. Most new tutorials are focusing on hooks usage and functional components while the older tutorials were using class components which relied on the usage of "this". I recommend reading about "this" in the following articles: https://medium.com/byte-sized-react/what-is-this-in-react-25c62c31480 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this https://www.w3schools.com/js/js_this.asp It's an important concept of JavaScript so I do suggest you to take the time to get familiar with it.
3rd Jan 2022, 7:55 PM
Burey
Burey - avatar