Functional Component vs Class Component in React.Js

A functional component in React is a JavaScript function that returns a React element, which is an object that describes a part of the UI. Functional components are also known as “stateless” components because they do not have a state. A class component in React is a JavaScript class that extends React.Component class. It has a state, which can be used to store the data that the component needs to render.

React.Js Lifecycle Methods

In React, a component goes through different phases in its lifecycle, and at certain points in each phase, React will call specific methods on the component. These methods are known as lifecycle methods. componentDidMount(), componentDidUpdate(prevProps, prevState), componentWillUnmount(), shouldComponentUpdate(nextProps, nextState)

Spread Operator and Rest Parameters in JavaScript

Spread operator in JavaScript was introduced in ES6. The syntax of the spread operator is 3 dots. The spread operator allows us to spread out the elements of an iterable object such as an Array, Map, or Set. Rest parameter in javascript allows us to handle multiple parameters in any function. We can pass an indefinite number of parameters to any function. By the use of the rest parameter, we can call a function with any number of arguments.