Why doesn't the called API data appear in the native picker? , Previously there was an
ActivityIndicatorand it was only loading, then I deleted theActivityIndicatorbut the API data didn't appear, but the console.log data was called, why?
const [data, setdata] = useState();
useEffect(() => {
const callApi = async () => {
await getData();
};
callApi();
}, []);
,,,,
,,,,
return (
<View style={styles.container}>
<Text style={styles.text}>Pilih Data</Text>
<View style={styles.picker}>
<Picker
selectedValue={data}
onValueChange={itemValue => setdata(itemValue)}>
{data &&
data?.map((item, key) => {
<Picker.Item
label={'${item.bencana}'}
value={'${item.ID }'}
key={key}
/>;
})}
</Picker>
</View>
)