React Hooks Tutorial - 3 - useState with Array

Published: 31 July 2021
on channel: JAS ACADAMY
6,122
62

What is a Hook?
A Hook is a special function that lets you “hook into” React features. For example, useState is a Hook that lets you add React state to function components. We’ll learn other Hooks later.

When would I use a Hook?
If you write a function component and realize you need to add some state to it, previously you had to convert it to a class. Now you can use a Hook inside the existing function component.

What is useState hook ?

useState is a Hook that allows you to have state variables in functional components. You pass the initial state to this function and it returns a variable with the current state value (not necessarily the initial state) and another function to update this value.

This tutorial serves as a complete guide to the useState Hook in React, the equivalent of this.state/this.setSate for functional components
Declaration :
import React, { useState } from 'react';
Syntax:
const [variable ,function]=useState(initialValue)

#jasacadamy #hook #useState


On this page of the site you can watch the video online React Hooks Tutorial - 3 - useState with Array with a duration of hours minute second in good quality, which was uploaded by the user JAS ACADAMY 31 July 2021, share the link with friends and acquaintances, this video has already been watched 6,122 times on youtube and it was liked by 62 viewers. Enjoy your viewing!