useState()
useState
is a Hook provided by React that allows you to add state to functional components.- It returns an array containing two elements: the current state value and a function(callback) to update that state.
- you can define multiple state in one functional component.
Syntax
const [state, setState] = useState(initialValue);