Why doesn't the called API data appear in the native picker?

Viewed 17

Why doesn't the called API data appear in the native picker? , Previously there was an ActivityIndicator and it was only loading, then I deleted the ActivityIndicator but 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>
    )
0 Answers
Related