react-places-autocomplete
react-places-autocomplete copied to clipboard
How to apply localization to children?
trafficstars
{({ getInputProps, suggestions, getSuggestionItemProps, loading }) => (
<div>
<input
{...getInputProps({
placeholder: 'Search Places ...',
className: 'location-search-input',
})}
/>
As above children, I want to translate place holder based on current language. I am using const { t: translate } = useTranslation(); How can I use translate('inputPlaceholder') instead of 'Search Places ...'
{({ getInputProps, suggestions, getSuggestionItemProps, loading }) => (
<div>
<input
{...getInputProps({
placeholder: translate('inputPlaceholder'),
className: 'location-search-input',
})}
/>
Error I got: Uncaught TypeError: translate is not a function Because translate is not available in children scope. Any help? Thanks.