PinnedLoading
- Modern JavaScript in React Documenta...
Modern JavaScript in React Documentation 1If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:
23* We define variables with[`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) and[`const`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const) statements. For the purposes of the React documentation, you can consider them equivalent to[`var`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var).
4* We use the`class` keyword to define[JavaScript classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). There are two things worth remembering about them. Firstly, unlike with objects, you*don't* need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of`this` in a method[depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Boxing_with_prototype_and_static_methods).
5* We sometimes use`=>` to define["arrow functions"](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions). They're like regular functions, but shorter. For example,`x => x * 2` is roughly equivalent to`function(x) { return x * 2; }`. Importantly, arrow functions[don't have their own`this` value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_separate_this) so they're handy when you want to preserve the`this` value from an outer method definition.
Something went wrong, please refresh the page to try again.
If the problem persists, check theGitHub status page orcontact support.
If the problem persists, check theGitHub status page orcontact support.
Uh oh!
There was an error while loading.Please reload this page.