Oyenola Philip
Genius Programmer

Genius Programmer

The JavaScript you need to learn React in 2022

Oyenola Philip's photo
Oyenola Philip
·Jun 21, 2022·

2 min read

The JavaScript you need to learn React in 2022

We all know React today as a Library built in JavaScript and we know the power and flexibility it gives to the front end developers. Today we are going to be exploring on all the JavaScript you need to learn React in 2022. There are a lot of things to Learn in React as it gives us the power to build responsive and dynamic UI.

  1. Arrow Functions In JavaScript: Arrow functions are very key in learning react because it simplifies and beautify our code. It helps us keep our code easier to read to other developers. Check out the difference between an arrow function and the traditional function in JavaScript in this code.
const myFunc = function() {
  const myVar = "value";
  return myVar;
}
const myFunc = () => {
  const myVar = "value";
  return myVar;
}
  1. Template Literals: Template Literals is also a great feature in JavaScript as it was added in ES6 part of JavaScript. Template literals allow you to create multi-line strings and to use string interpolation features to create strings. Check Out the code here to see what I mean.
const person = {
  name: "Zodiac Hasbro",
  age: 56
};

const greeting = `Hello, my name is ${person.name}!
I am ${person.age} years old.`;

console.log(greeting);

This code actually prints or log out "Hello my name is Zodiac Hasbro! I am 56 years old". Fun right let's move to the third one on the list.

  1. Ternary Operators In JavaScript Ternary Operators in JavaScript are also a fun way of learning React and also getting fun of this Library. The conditional operator, also called the ternary operator, can be used as a one line if-else expression. See the Code below to confirm and see the power of ternary operators if/else conditionals
    function findGreater(a, b) {
    if(a > b) {
     return "a is greater";
    }
    else {
     return "b is greater or equal";
    }
    }
    
    and this ternary operators
    function findGreater(a, b) {
    return a > b ? "a is greater" : "b is greater or equal";
    }
    

With Learning ES6 and ES7 you can become very strong and powerful in React and also explore Frameworks Like NEXT, Angular and Vue. To learn more of React you can take courses fro FreeCodeCamp to get into the fun Library. Thanks for reading and Happy coding.

 
Share this