What is useState() in React?

useState is a React Hook that lets you track data or properties in your component.

const [state, setState] = useState(initialState)

You can initialize the state while declaring it and then setState in response to any event like

function handleClick() { setState(newState); }