I have a FormattedNumber component that looks like this:
<FormattedNumber
style="percent"
maximumFractionDigits={2}
value={0.555}
>
</FormattedNumber>
And a function that takes a String as an input, I need to pass the FormattedNumber's result to the function, I tried using this to obtain the number:
const num = ReactDOMServer.renderToString(
<FormattedNumber
style="percent"
maximumFractionDigits={2}
value={0.543}
>
</FormattedNumber>
)
but it fails with error Unhandled Rejection (Error): [React Intl] Could not find required intl object. <IntlProvider> needs to exist in the component ancestry.
I need a way to convert FormattedNumber to a String, and it has to work with percentages, currency, etc.