Open monabeeltahir opened 1 year ago
Hi, You should map labels manually.
So this is how I define the labels. The issue with this approach is that it only renders or defines labels once. const [items, setItems] = useState([ {label: strings.food, value: 'Food'}, {label: 'Dental', value: 'Dental'}, {label: strings.medical, value: 'Medical'}, {label: strings.housing, value: 'Housing'}, {label: strings.womenhealth, value: 'Women'} ]);
I am using 'react-localization' library and declaring the strings with translations.
Try this method:
const [items, setItems] = useState([]);
useEffect(() => {
setItems([
{label: strings.food, value: 'Food'},
{label: 'Dental', value: 'Dental'},
{label: strings.medical, value: 'Medical'},
{label: strings.housing, value: 'Housing'},
{label: strings.womenhealth, value: 'Women'},
]);
}, [strings]);
Thanks.
Hello!
I am trying to add multi language support in dropdown menu. In my home screen I have change language button but I am finding it difficult to change the language for the dropdown menu labels