If you are working with javascript for a while, you will agree with me. This ‘this’
keyword is very confusing when you are writing code, especially when you read others code.
This may be controversial, but for me it's the this
keyword.
➡️ this
has a different values depending on where it is used.
➡️ Inside a method this
refers to the owner object.
➡️ When alone this
refers to the global object.
➡️ Inside a function this
this refers to the global object too.
➡️ In a function, in strict mode this
is undefined.
➡️ In a event this
refers to the element that received the event.
However, since 2019 I've been using React Hooks, I haven't had to use the this
keyword once.
Learn More About React Hooks On official website.
React Hooks.
Do you like React Hooks too?
Let's discuss it more in the comments section. If you agree don't forget to like ❤️ and save 📌
😎Keep Focused And Just Code It!