Build a simple Counter App using React Hooks in ReactJS in Hindi

Опубликовано: 31 Октябрь 2024
на канале: DevTechHub
69
1

Welcome, How to create a counter app using react hook in Reactjs . In simple terms create a button that will increment and decrement the state of a variable count by 1.

First, we will make a react component stateful using React Hooks.
What is 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.

The syntax of useState hook
const [counter(currentvalue), setCounter(updatedvalue)] = useState(initialValue)

What does useState return?
It returns a pair of values: the current state and a function that updates it.
This is why we write const [count, setCount] = useState().

Source Code:
https://github.com/NaeemShaikho/React...