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
- Build your own Reactpomb.us
- Why React Re-Renders • Josh W. Comeaujoshwcomeau.com
- You Might Not Need an Effect – Reactreact.dev
- How Props Work in React – A Beginner's Guidefreecodecamp.org
- Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior · Mark's Dev Blogblog.isquaredsoftware.com
- Tutorial: Tic-Tac-Toe – Reactreactjs.org
- Implementing React from scratchrob.directory
- 5 Differences Between Arrow and Regular Functionsdmitripavlutin.com
- Understanding useMemo and useCallback • Josh W. Comeaujoshwcomeau.com
- When does React re-render components? | Felix Gerschaufelixgerschau.com
- State as a Snapshot – Reactreact.dev
- The Interactive Guide to Rendering in Reactui.dev