| 20 | } |
| 21 | |
| 22 | const FormattedPlural: React.FC<Props> = props => { |
| 23 | const {formatPlural, textComponent: Text} = useIntl() |
| 24 | const {value, other, children} = props |
| 25 | |
| 26 | const pluralCategory = formatPlural(value, props) |
| 27 | const formattedPlural = props[pluralCategory as 'one'] || other |
| 28 | |
| 29 | if (typeof children === 'function') { |
| 30 | return children(formattedPlural) |
| 31 | } |
| 32 | if (Text) { |
| 33 | return <Text>{formattedPlural}</Text> |
| 34 | } |
| 35 | // Work around @types/react where React.FC cannot return string |
| 36 | return formattedPlural as any |
| 37 | } |
| 38 | |
| 39 | FormattedPlural.displayName = 'FormattedPlural' |
| 40 |
nothing calls this directly
no test coverage detected