【发布时间】:2016-05-13 04:42:03
【问题描述】:
如果我错了,请纠正我,ReactIntl 中的 FormattedMessage 返回一个由 span 标签包裹的字符串。在 ReactIntl 1.2 中,我们可以选择使用 this.getIntlMessage('key') 来仅获取字符串部分。
这是我的问题:ReactIntl 2.0 中是否有类似的功能?我知道字符串可以通过使用 FormattedMessage 中的 Function-As-Child 模式作为
<FormattedMessage id="placeholder">
{(formattedValue)=>(
<MyComponent ref="mycomponent" placeholder={formattedValue}/>
)}
</FormattedMessage>
但是,它弄乱了我组件中的“引用”,我无法再使用this.refs.mycomponent 访问该组件。
【问题讨论】:
标签: reactjs react-intl