Learn about scopes, closures, arrow functions, literal notations, expressions, destructuring, rest/spread syntax, promises, modules, and more.

React developers love the modern features in JavaScript and use them extensively in their projects. In this guide, I’ll go over the most popular features that are usually used with React. Most of these features are modern to JavaScript but I’ll also talk about some older ones that are related and important for React.

This will NOT be a complete list of everything offered by the JavaScript language but rather the subset that I think will help you write better code for React.

Block scopes and the var/let/const keywords

A block scope is created with a pair of curly brackets. This happens every time you create an if-statement, for-statement, while-statement, etc. The only exception is the curly brackets you use with functions. These create a function scope, not a block scope.

Block and function scopes

{
  // Block Scope
}

if (true) {
  // Block Scope
}

for (var i = 1; i <= 10; i++) {
  // Block Scope
}

function doSomething() {
  // Function Scope
}

#javascript #react #web-development #developer

All The JavaScript You Need to Know Before Starting with React
3.00 GEEK