I am new to React and learning it. From this link:
There are mainly two components in React:
- Functional Components also known as Stateless component
- Class Component also known as Stateful component
and it seems that functional components are the rage these days e.g., I inherited some code and it uses functional components everywhere. The same article is then saying:
... a functional component is just a plain JavaScript function, we cannot use setState() method inside component. That’s why they also get called functional stateless components. ... useState can be used to store state in a functional component.
and I do see tons of code using useState in functional components to modify state. Can someone explain this to me?