I am using react-bootstrap
for rendering my select dropdown and I am trying to pass a custom element to the options. I need to display translated values in the dropdown:
<Form.Label ><Translate id="labels.sortKey" /></Form.Label>
<Form.Control as="select" value={props.sort.key} onChange={(e) => props.sortAction(e.target.value)}>
<option value="name"><Translate id="basic.name" /></option>
<option value ="state"><Translate id="basic.state" /></option>
</Form.Control>
Unfortunately, this renders as [Object object]
instead of the translated value and I get an error Only strings and numbers are supported as <option> children
.
Is there some alternative element that I could use instead of <option>
that supports custom elements without the need to use some third-party library?
EDIT:
The following code (which is pretty much identical with the code from the official docs) throws an exception translate is not a function
:
<Translate>
{translate =>
<h1>{ translate('test') }</h1>
}
</Translate>