DEV Community

kfk
kfk

Posted on

class grammar suport to react hooks

reason: Sometimes OOP is better suited to address work requirements
Because some functions are not reusable enough, the component hierarchy is unclear
Alt Text

if use oop code:
Alt Text

this class component only cares about layout and logicless when rendering
In this case. The code is better organized and supports hooks.

Some say that hooks write function component that is prone to confusion,But this is untenable

Hooks are open to support both FP and OOP

So do not say that hooks cause confusion; they are open and have unlimited possibilities

Top comments (0)