Maybe I’m wrong so please help me understand. But my impression is you can’t use HOCs directly as decorators anymore. Is this accurate?
-
-
Replying to @dan_abramov
In other words it seems like class decorator now has to return an object. Whereas in the past it could just return a new function alone.
3 replies 0 retweets 4 likes -
Replying to @dan_abramov
No I'm almost certain that's wrong. Class decorators are just about the same as they were, except now take a second arg.
1 reply 0 retweets 2 likes -
Replying to @AdamRackis @dan_abramov
Sadly
@nzgb doesn't explicitly say it, but I'm pretty sure you can just return a new classpic.twitter.com/Pd1rCh6kX7
2 replies 0 retweets 1 like -
Replying to @AdamRackis @nzgb
cc
@wycats, curious if you could clarify this! I’m getting lost. Is Klass => Klass still a valid decorator?2 replies 0 retweets 2 likes -
No. We moved to descriptor, which gives a lot more power (without too much complexity) but isn't quite that simple.
2 replies 0 retweets 1 like -
But you can still do Class => { * mutate Class * //return undefined } right?
1 reply 0 retweets 0 likes -
Replying to @AdamRackis @wycats and
Ugh all my `
@connect` calls in react-redux will break
1 reply 0 retweets 0 likes -
Replying to @AdamRackis @dan_abramov and
But your usage won't. You'll just have to change the decorator once.
2 replies 0 retweets 0 likes -
Replying to @wycats @AdamRackis and
You don't mutate the class, you supply additional members, which get added. It's not that bad. I should write a microsite.
3 replies 0 retweets 2 likes
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.
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.