Some important topics of JavaScript before diving into React
A Thread🧵
1️⃣ ES6 classes
Although new developers are working with functional components, there is a possibility that you may encounter old written class component code. So it can be helpful to learn basic of ES6 class.
2️⃣ Basic understanding of var, let and const
You should have the basic understanding of variable declaration. When to use var, let or const. What is the block scope and stuff like that.
for example
var x = 2;
// Here x is 2
{
let x = 4;
// Here x is 4
}
// Here x is 2
3️⃣ Arrow functions syntax
Arrow function is a new ES6 feature that's been used almost widely in modern codebases because it keeps the code concise and readable. It allows a short syntax for writing function expressions.
4️⃣ Destructuring assignment
Destructuring is a convenient way of accessing multiple properties stored in objects and arrays.
Let's say:
const person = {
firstName: 'Pratham',
lastName: 'Kumar'
}
Everything you need to know about useEffect hook of React
A beginner's guide
Thread🧵👇
If you're familiar with class components then you might know that we have various lifecycle methods but in functional components, we don't have any lifecycle methods.
Instead we have a powerful hook called useEffect💪
By using useEffect, you tell React that your component needs to do something after render. React will remember the function you passed (we'll refer to it as our “effect”), and call it later after performing the DOM updates