React JS — Functional Components and Hooks (Part 3)
Jun 26, 2021
It is simple javascript functions that accept properties(props) in function and return HTML(JSX). It doesn’t have any state and lifecycle.
So, functional components are very simple but not powerful. But after React 16.8 version Functional components comes up with a new concept of Hooks, this makes it as powerful as Class by putting state and lifecycle through hooks.
Hooks:
State Hook
With state hooks now we can maintain the state of components.
State vs variable: Page doesn’t rerender when variable updated but render when state updated
useState: