11/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13/* harmony export */ });
14/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");15
16
17var Home = function Home() {
14/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
15
16
17var Home = function Home() {18 var foo = "React";19 var bar = "TypeScript";20 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("h1", null, "Hello ", foo, " + ", bar);21};22
23/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Home);
24
14/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
15
16
17var Home = function Home() {18 var foo = "React";19 var bar = "TypeScript";20 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("h1", null, "Hello ", foo, " + ", bar);21};22
23/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Home);
24
11/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13/* harmony export */ });
14/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");15
16
17var Home = function Home() {
15/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
16
17
18var Home = function Home() {19 var foo = "React";20 var bar = "TypeScript";21 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("h1", null, "Hello ", foo, " + ", bar);22};23
24/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Home);
25
Declare variables at the top of their scope as it improves code readability, performance and also helps in code navigation.
The vars-on-top
rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behavior by manually moving the variable declaration to the top of its containing scope.
// Variable declarations in a block:
function doSomething() {
var first;
if (true) {
first = true;
}
var second;
}
// Variable declaration in for initializer:
function doSomething() {
for (var i=0; i<10; i++) {}
}
function doSomething() {
var first;
var second; //multiple declarations are allowed at the top
if (true) {
first = true;
}
}
function doSomething() {
var i;
for (i=0; i<10; i++) {}
}