Trans component alternative usage - wrong child number
See original GitHub issueDescribe the bug When I use Trans component like this https://react.i18next.com/latest/trans-component#alternative-usage . I have to set wrong child number to make it work properly.
Occurs in react-i18next version 10.11.0
Case 1
<Trans i18nKey={
modal:${textKey}}>Hello! <br/> some text. </Trans>
Translation string: "surveyCreatedText": "Hello! <1/> some text."
This case is ok.
Case 2
components = [<br />]
<Trans i18nKey={
modal:${textKey}} components={components} />
Translation string: "surveyCreatedText": "Hello! <1/> some text."
Gives “Hello! some text.” without
Case 3
components = [<br />]
<Trans i18nKey={
modal:${textKey}} components={components} />
Translation string: "surveyCreatedText": "Hello! <0/> some text."
Gives desired result and warning “Each child in a list should have a unique “key” prop. …”
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
should be fixed in react-i18next@10.11.4
I’m still seeing the problem in version
11.8.13
😦Here’s my code:
That gives me the
Each child in a list should have a unique "key" prop
warning.When I add the key to the component in the array, the warning goes away, but it sounds like this was already fixed previously?