Thus to maintain state inside the function, React provides several hooks:
Read moreWhere do you define a state in React?
React components has a built-in state object . The state object is where you store property values that belongs to the component. When the state object changes, the component re-renders.
Read more