react-i18next: Cannot pass several components to
Describe the bug I try to pass several components created by map function to Trans component, but for now it renders only the first wrapper element
Occurs in react-i18next version npm module version 10.0.5
To Reproduce Steps to reproduce the behavior:
- Create Trans with components property
[ <ul>{['item1', 'item2'].map((item) => (<li key={item}>{item}</li>))}</ul>]
- In translation.json: “test”: “some list: <0></0>”
- See that it renders only the ul
Also, if I pass iterable component to a values property, it renders [object Object], because values property cannot accept objects.
Expected behaviour I want to pass whole component as a translation variable,
Sample to see https://codesandbox.io/s/ojqxzpw86y
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 19 (14 by maintainers)
@brumeregan than don’t use map but a standalone component
These values, that need to be included in translation string are dynamic. I get those values from server they are not hardcoded. Example:
start of the list <ul></ul> end of the list
How can i render nested array?