我正在使用Alt库(Flux实现)和React-Native。我非常喜欢' alt / utils / decorators'和' alt / utils / connectToStores'但是我不能使用这些@decorator,因为RN / Babel配置似乎不支持它。
我绝对不熟悉Babel(或RN),因此我需要帮助配置RN / Babel以与@decorators合作。
如何使用Alt库的@decorators和React-Native?
答案 0 :(得分:4)
Babel 6目前打算让transform-decorators
支持即将对装饰者提案进行更改,这将使其与现有提案的行为完全不同。
如果您需要Babel 6中的装饰器与Babel 5中的装饰器具有相同的语义,那么您最好的选择是使用babel-plugin-transform-decorators-legacy。
答案 1 :(得分:1)
参见0.16发行说明:
装饰者在巴贝尔T2645降落之前不会工作。
https://github.com/facebook/react-native/blob/master/breaking-changes.md
一旦修复,他们应该开始工作。