Reputation: 655
I am using react with typescript. What is the difference between FC
vs Component
?
Which is best practice?
Use cases for each?
Does Component
is deprecated since react latest version with hooks is not using classes?
Upvotes: 1
Views: 1449
Reputation: 6952
(following is just my MHO)
"Old" react is not deprecated yet and react team is also not planning to remove class components in near future. But in general using react hooks is highly recommended by react developers. Also it is a more functional approach, which might be good or bad for you depending on your experience. (btw i prefer functional programming)
useState
hook). Also it's much easier to share stateful logic accross very different componentsuseEffect
hook)useContext
hook)This are just the main differences for more details see here.
Upvotes: 2