-1

How can I add data to intl.formatMessage on react-intl, an example: this is showing product.select.data

<FormattedMessage id={"product.select." + data} />

But, How can I do same with intl.formatMessage? this not working. this is showing product.select.undefined

props.intl.formatMessage({ id: "product.select." + data})
Marcus
  • 57
  • 1
  • 5

1 Answers1

0

This should work the same way, if data is defined, which does not seem to be the case in your second example. Maybe you should double-check if data is initialized correctly before your call to intl.formatMessage.

Spacetoaster
  • 59
  • 1
  • 5