Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 26, 2021 05:47 pm GMT

Javascript fundamentals before learning react

Before Going to Learn React You must need Some JavaScript concepts.

  • let,var and const
  • function and arrow functioncallback
  • hight order function
  • class
  • destructuring array and object
  • import and export
  • HTML and CSS Basic

Don't worry I will explain you in details.

let,var and const

let,var,const are just a variable declaring. let and const are come in ES6.
Before we use var for variable declaring. There are some advantages of using var and let.
var is used for functional scope and let is used for block scope.
Block scoped is only work in inside this { } and you can't call this variable outside of the scope. Var is used in function scope means like a global variable. You can call it from anywhere.CONST is the same use let but const is used only in const value , Array and Object.

function and arrow function

function is used to avoid DRY(Don't Repeat Yourself). You can declare a function like this.

function add(a,b)     {            return a + b     } 

What is arrow function? Arrow function is a new way to declaring function that comes in ES6. You can easily convert the above function into an arrow function like this.

   const add = () => { a + b} ;

It is short right ??

Callback

callback ?? confusing Don't worry I will explain easy way .
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action. see in demo

  setTimeout( function name(){             console.log("This is zaw");             },1000)

High Order Function

Higher-order functions are functions that take other functions as arguments or return functions as their results. Some high-order functions are map, filter, reduce, etc,.. .I am not going this in detail there are many articles on this you can easily search and read it.
link

Destructuring array and object

Destructuring is spliting value into pieces.

  const array = [ one:1,two:2,three:3,four:4];   const [one,two,three,four] = array;   console.log(one);//you will get 1  console.log(two);/2

To destruturing object

const Obj = { name:"Zaw",age:21,gender:"male"};const {name,age,gender} = Obj;console.log(name); //Zawconsole.log(age);

import and export .

import is used to call packages that already on .

 import React from {React} .

Export is used to export your own package that you have been written and you can call by using import when You need it.

  export package;

Thank for reading this I hope this will helpful to you please give me your feedback .I wrote this according to my experience if you found any mistake feel free to DM me on twitter hareom284


Original Link: https://dev.to/hareom284/javascript-fundamentals-before-learning-react-1mkl

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To