Exploring the possibilities of React Native and TypeScript, I find myself wondering if it's feasible to dynamically create a picker component. Instead of defining state variables statically like (const [selectedQLType, setQLTypePicker] = useState('');), is there a way to generate these state variables dynamically? This would allow for creating multiple pickers using a map function based on an array of parameters.
import {Picker} from '@react-native-picker/picker';
... const [selectedQLType, setQLTypePicker] = useState('');
return (
<View>
<Picker
selectedValue={selectedQLType}
onValueChange={(itemValue, itemIndex) => setQLTypePicker(itemValue)}>
{variableType.map(itemIdx =>
<Picker.Item
label={itemIdx}
key={itemIdx}
value={itemIdx}
/>)}
</Picker>