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>
);
}
Top comments (0)