Javascript fundamentals before learning react

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

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

Don’t wor…


This content originally appeared on DEV Community and was authored by Zaw Zaw Win

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

  • let,var and const
  • function and arrow function callback
  • 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); //Zaw

console.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


This content originally appeared on DEV Community and was authored by Zaw Zaw Win


Print Share Comment Cite Upload Translate Updates
APA

Zaw Zaw Win | Sciencx (2021-09-26T17:47:33+00:00) Javascript fundamentals before learning react. Retrieved from https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/

MLA
" » Javascript fundamentals before learning react." Zaw Zaw Win | Sciencx - Sunday September 26, 2021, https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/
HARVARD
Zaw Zaw Win | Sciencx Sunday September 26, 2021 » Javascript fundamentals before learning react., viewed ,<https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/>
VANCOUVER
Zaw Zaw Win | Sciencx - » Javascript fundamentals before learning react. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/
CHICAGO
" » Javascript fundamentals before learning react." Zaw Zaw Win | Sciencx - Accessed . https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/
IEEE
" » Javascript fundamentals before learning react." Zaw Zaw Win | Sciencx [Online]. Available: https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/. [Accessed: ]
rf:citation
» Javascript fundamentals before learning react | Zaw Zaw Win | Sciencx | https://www.scien.cx/2021/09/26/javascript-fundamentals-before-learning-react-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.