运行 React.Intl <FormattedMessage> 函数
Run function on React.Intl <FormattedMessage>
我正在尝试 运行 一个函数来对 FormattedMessage 的结果进行进一步的字符串操作。即使在 运行 通过下面的函数将其设置为 :
之后,我也找不到方法
<Button text={ this.testMethod(buttonText) } />
testMethod(result){
return result;
}
总结:我正在尝试获取实际文本而不是对象,然后进行一些字符串操作。
不想要这个:
{id: "test", defaultMessage: "你好"}
需要:访问“Hello there”,例如提取单词“there”
我正在尝试 运行 一个函数来对 FormattedMessage 的结果进行进一步的字符串操作。即使在 运行 通过下面的函数将其设置为 :
之后,我也找不到方法<Button text={ this.testMethod(buttonText) } />
testMethod(result){
return result;
}
总结:我正在尝试获取实际文本而不是对象,然后进行一些字符串操作。
不想要这个: {id: "test", defaultMessage: "你好"}
需要:访问“Hello there”,例如提取单词“there”