'Hooks Vs classes in React
I am new in React , I was reading the Readct offical documentation and I saw that I can create states by two ways , classes and hook. My question is which way should I use for my React projects and why .
Thanks to evryone
Solution 1:[1]
Actually, I see the React community really engaged with Hooks. They are more simple and make your code easier to read and less verbose. Besides, with Hooks is really more easy to refactor your code.
I recommend you to pay more attention to Hooks, but It'll be fine if you see how classes work as well (a lot of projects still use classes).
Solution 2:[2]
There is an awesome StackOverflow here. There is no right or wrong answer to this. I think that hooks carry the day here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Douglas Brandão |
| Solution 2 | ABEL MASILA |
