Let’s say you have an array and you need to come up with a function that checks if the array has a given number n.
For some time we had been referring to function components as stateless components and would have to write a
class every time we needed to make use of a local state. However, with the introduction of hooks in React 16.8, one can now use the inbuilt hook called
useState or otherwise called State Hook that lets one add local state to function components.