How To Display Wifi List Promise Values React Native

I’m using the react-native-wifi-reborn package to get a list of all nearby wifi points. How do I get the list out of the promise? I’ve looked at one solution and it uses a class, but where my app calls the function to get the list, it isn’t in one.

const MainScreen = ({navigation}) => {

    requestFineLocationPermission();

    WifiManager.setEnabled(true);
    let wifiList = WifiManager.reScanAndLoadWifiList().then((data) => {return data});

    console.log(wifiList);

    return (

        <Layout style={styles.container}>
                
                ......

        </Layout>
    );
}

export default MainScreen;

When wifiList is logged, the output is {"_U": 0, "_V": 0, "_W": null, "_X": null}

8 thoughts on “How To Display Wifi List Promise Values React Native”

Leave a Comment