So glad we didn’t enable decorators in CRA despite the popularity. The stage 2 version looks quite different to me.https://twitter.com/left_pad/status/897470712277028864 …
-
-
In case of connect() it returns a different class altogether (as common for HOCs).
-
You can probably accomplish your use case with class finishers, but
@littledan and I recently changed the spec to require a subclass iirc -
We should look at this use case to see if "constructor replacement" is a feature we need to add back.
-
By that do you mean returning a NEW constructor? ie `Class => class extends Class{}`? If so yeah, that would be incredibly handy.
-
That's not what HOCs do though. They return a completely different class.
-
Right Class => class extends Class ie they return a NEW class, like connect. Did you reply to the wrong tweet? :)
-
Ah sure. Doesn't *have to* be Class => class extends Class could just be Class => class { /* somehow ref Class */ } either way - NEW class
-
Corollary to the above: this would be a massive breaking change to not only stage 1, but also TypeScript class decorators.
- 15 more replies
New conversation -
-
-
The extra power allows you to add public and private fields, which is great when you need some state for a getter you're making.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Wouldn't supplying additional members == mutating? Ie you're mutating the class - changing it. Am I misunderstanding you?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
