An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
November 23, 2022 03:59 am GMT
Original Link: https://dev.to/harshilshah99/usestate-hook-react-2inf
UseState Hook React
UseState Hook
The React useState Hook allows us to track state in a function component.
State generally refers to data or properties that need to be tracking in an application.
import React,{useState} from 'react';function Example(){const [count,setCount] = useState(0);return( <div> <p>you have clicked {count} times</p> <button onClick={()=> setCount(count+1)}> Click Me </button> </div> );}
Original Link: https://dev.to/harshilshah99/usestate-hook-react-2inf
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To