間違っている場合は修正してください。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
。