Is @ connect a grammatical sugar in react-redux? How to use it?

currently only know the traditional usage

const App = connect(
    mapStateToProps,
    mapDispatchToProps
)(Counter);

but many projects use

@connect(state => ({
  value: state.global.value,
  extinfo: state.extinfo,
}))

I can understand what it means, but do I still want to get a more comprehensive understanding of how this grammar is used?

Mar.02,2021

https://www.tslang.cn/docs/ha.


you'd better honestly use the first one.
although the second can be parsed through babel . But none of the Ecma standards has been officially released.

unless you convert all kinds of babel , the compatibility of various browsers is in the palm of your hand.


react-redux is too troublesome to write. It is recommended that you use react-mobx, to make it easy to use


react-redux is too troublesome to write, and it is recommended that you use react-mobx, to make it easy to use


this is decorator mode.
first install babel-plugin-transform-decorators-legacy,
and then in .babelrc

"plugins": ["transform-decorators-legacy"]

is fine

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b22878-2b618.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b22878-2b618.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?