|
|
|
|
|
by ng12
2570 days ago
|
|
@observable/useState/React.Component.state are all conceptually identical, just with varying implementations of the magic. All of them summon an observable value from the void and provide some method of updating said observable. That said, @State seems most identical to useState -- it provides an observed value which you use $/.binding to update. > It's very weird and funky because the whole point of non-class components is for them to be pure functions which have no state. That's a false assumption, that's not the "point" of functional components. Functional components were always pure simply because there was no way to make them stateful. There are distinct benefits for using stateful functional components over classes -- mainly less boilerplate and abstractable/re-usable state functions. |
|