问题描述
我正在使用带有React-Native的库(Flux实现)。我非常喜欢'alt / utils / decorators'和'alt / utils / connectToStores',但我不能使用这些@decorators,因为RN / Babel配置似乎不支持它。
I am using the Alt library (Flux implementation) with React-Native. I really like the 'alt/utils/decorators' and 'alt/utils/connectToStores' but I cannot use these @decorators because the RN/Babel config doesn't seem to support it.
我绝对不熟悉Babel(或RN),所以我需要帮助配置RN / Babel与@decorators合作。
I'm definitely not well versed in Babel (or RN for that matter) so I am in need of help configuring RN/Babel to work with @decorators.
如何使用Alt库的@decorators与React-Native?
How can I use the Alt library's @decorators with React-Native?
推荐答案
Babel 6目前打算用于 transform-decorators
支持即将对装饰器提议进行的更改,这将使其与现有装置的行为完全不同。
Babel 6 currently intends for the transform-decorators
to support the upcoming change to the decorators proposal, which will make it behave quite differently from the existing one.
如果您需要Babel 6中的装饰器与Babel 5中的装饰器具有相同的语义,您最好的选择是使用。
If you need decorators in Babel 6 with the same semantics as decorators in Babel 5, your best option is to use babel-plugin-transform-decorators-legacy.
这篇关于React-Native中的Alt @decorators的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!