React function components do produce shorter code. But they are also impossible to understand without knowing what is their corresponding class component.
Hooks were introduced much after classes, and just require less code, so everyone is using them now instead of classes.
This should only be used for things that happen outside of the state that React trackes, e.g.
window
event handlers.Examples:
Articles by others on the same topic
There are currently no matching articles.